*/ class Pages extends Block_Abstract { use Singleton; public const NAME = 'advanced-sidebar-menu/pages'; /** * Get the description of this block. * * @return string */ protected function get_description() { return __( 'Creates a menu of all the categories using the parent/child relationship', 'advanced-sidebar-menu' ); } /** * Get featured this block supports. * * Done on the PHP side, so we can easily add additional features * via the PRO version. * * @return array */ protected function get_block_support() { return apply_filters( 'advanced-sidebar-menu/blocks/pages/supports', [ 'anchor' => true, ] ); } /** * Get list of words used to search for the block. * * English and translated so both will be searchable. * * @return array */ public function get_keywords() { return [ 'Advanced Sidebar', 'menu', 'sidebar', 'pages', __( 'menu', 'advanced-sidebar-menu' ), __( 'sidebar', 'advanced-sidebar-menu' ), __( 'pages', 'advanced-sidebar-menu' ), ]; } /** * Get list of attributes and their types. * * Must be done PHP side because we're using ServerSideRender * * @link https://developer.wordpress.org/block-editor/reference-guides/block-api/block-attributes/ * * @phpstan-return array, ATTR_SHAPE> * @return array */ protected function get_attributes(): array { return (array) apply_filters( 'advanced-sidebar-menu/blocks/pages/attributes', [ Page::INCLUDE_PARENT => [ 'type' => 'boolean', ], Page::INCLUDE_CHILDLESS_PARENT => [ 'type' => 'boolean', ], Page::ORDER_BY => [ 'type' => 'string', 'default' => 'menu_order', ], Page::EXCLUDE => [ 'type' => 'string', 'default' => '', ], Page::DISPLAY_ALL => [ 'type' => 'boolean', ], Page::LEVELS => [ 'type' => 'number', 'default' => 100, ], ] ); } /** * Return a new instance of the Page widget. * * @return Page */ protected function get_widget_class() { return new Page(); } }