-
Notifications
You must be signed in to change notification settings - Fork 18
Editor
Nicolas Juen edited this page Aug 13, 2021
·
4 revisions
You have to create a script in the dist/admin-editor-script.js
plugin folder.
This will load it automatically on ADMIN side.
Edit the method inc/Services/Editor.php after_theme_setup
Example :
add_theme_support( 'disable-custom-colors' );
add_theme_support( 'disable-custom-gradients' );
add_theme_support(
'editor-color-palette',
[
[
'name' => __( 'Dark green', 'beapi-frontend-framework' ),
'slug' => 'dark-green',
'color' => '#293F06',
],
]
);
add_theme_support(
'editor-font-sizes',
[
[
'name' => __( 'Heading 6', 'beapi-frontend-framework' ),
'shortName' => __( 'S', 'beapi-frontend-framework' ),
'size' => 21,
'slug' => 's',
],
]
);
Edit the file inc/Services/Editor_Patterns.php method register_categories
and register patterns categories :
public function register_categories(): void {
register_block_pattern_category(
'cover',
[
'label' => _x( 'Cover', 'Block pattern category', 'beapi-frontend-framework' ),
],
);
}
Edit the file inc/Services/Editor_Patterns.php method register_patterns
and register patterns categories :
public function register_patterns(): void {
register_block_pattern(
'project/pattern',
[
'title' => __( 'Group list', 'beapi-frontend-framework' ),
'categories' => [ 'cover' ],
'content' => $this->get_pattern_content( 'src/stories/patterns/block-patterns/GroupListing/GroupListing.html' ),
'blockTypes' => ['core/paragraph']
]
);
}
The method will get the content of the pattern, relative to the theme folder.