Skip to content

Commit 86916e6

Browse files
committed
gcn-add-page-icon.php: Added filter(s) to add page icon when adding and updating a page.
1 parent 89dd602 commit 86916e6

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

gc-notion/gcn-add-page-icon.php

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
/**
3+
* Gravity Connect // Notion // Add Page Icon
4+
* https://gravitywiz.com/documentation/gravity-connect-notion/
5+
*
6+
* Notion page POST reference:
7+
* https://developers.notion.com/reference/post-page
8+
*/
9+
10+
/**
11+
* Alternatively, you can use the `gcn_notion_page_data_add` or `gcn_notion_page_data_update` filters
12+
* separately to add/change the icon only when adding or updating a page.
13+
*
14+
* The filter also supports FORM_ID and FEED_ID modifiers to allow easy scoping to specific forms and feeds.
15+
*
16+
* See the full filter reference for more details:
17+
* https://gravitywiz.com/documentation/gcn_notion_page_data/
18+
*/
19+
add_filter( 'gcn_notion_page_data', function( $page_data, $form, $entry, $feed ) {
20+
/**
21+
* Modify the $emoji variable to change the icon. Note that the Notion API requires a single emoji character.
22+
*/
23+
$emoji = '🦚';
24+
25+
$page_data['icon'] = array(
26+
'type' => 'emoji',
27+
'emoji' => $emoji,
28+
);
29+
30+
return $page_data;
31+
}, 10, 4 );

0 commit comments

Comments
 (0)