Monday, January 2, 2023
HomeWordPress Developmentblock editor - The place is getSite selector outlined?

block editor – The place is getSite selector outlined?


I discovered it – it’s dynamically injected as entity in gutenberg/packages/core-data/src/index.js, on line 22

const entitySelectors = rootEntitiesConfig.cut back( ( outcome, entity ) => {
    const { type, title } = entity;
    outcome[ getMethodName( kind, name ) ] = ( state, key, question ) =>
        selectors.getEntityRecord( state, type, title, key, question );
    outcome[ getMethodName( kind, name, 'get', true ) ] = ( state, question ) =>
        selectors.getEntityRecords( state, type, title, question );
    return outcome;
}, {} );

Whereas entities are outlined in gutenberg/packages/core-data/src/entities.js,
it’s this entity:

    {
        label: __( 'Web site' ),
        title: 'web site',
        type: 'root',
        baseURL: '/wp/v2/settings',
        getTitle: ( report ) => {
            return get( report, [ 'title' ], __( 'Web site Title' ) );
        },
    },

EDIT:
getSite doesn’t take any parameters and it returns object with following properties:

0: "title"​
1: "description"​
2: "url"​
3: "electronic mail"​
4: "timezone"​
5: "date_format"​
6: "time_format"​
7: "start_of_week"​
8: "language"​
9: "use_smilies"
10: "default_category"​
11: "default_post_format"​
12: "posts_per_page"​
13: "show_on_front"​
14: "page_on_front"​
15: "page_for_posts"​
16: "default_ping_status"​
17: "default_comment_status"​
18: "site_logo"​
19: "site_icon"

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments