Skip to content

Commit 2f7af4e

Browse files
committed
gcn-add-page-icon.php: Added filter(s) to add page icon when adding and updating a page.
1 parent 4425281 commit 2f7af4e

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

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

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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+
* See the full filter reference for more details:
15+
* https://gravitywiz.com/documentation/gcn_notion_page_data/
16+
*/
17+
add_filter( 'gcn_notion_page_data', function( $page_data, $form, $entry, $feed ) {
18+
/**
19+
* Modify the $emoji variable to change the icon. Note that the Notion API requires a single emoji character.
20+
*/
21+
$emoji = '🦚';
22+
23+
$page_data['icon'] = array(
24+
'type' => 'emoji',
25+
'emoji' => $emoji,
26+
);
27+
28+
return $page_data;
29+
}, 10, 4 );

0 commit comments

Comments
 (0)