array( $this, 'render_faq' ), ) ); register_block_type( AEOMATIC_DIR . 'blocks/faq-item', array( 'render_callback' => array( $this, 'render_faq_item' ), ) ); } public function render_faq( array $attrs, string $content ): string { if ( empty( $content ) ) { return ''; } return sprintf( '
%s
', $content ); } public function render_faq_item( array $attrs ): string { $q = isset( $attrs['question'] ) ? wp_kses_post( $attrs['question'] ) : ''; $a = isset( $attrs['answer'] ) ? wp_kses_post( $attrs['answer'] ) : ''; if ( '' === trim( wp_strip_all_tags( $q ) ) || '' === trim( wp_strip_all_tags( $a ) ) ) { return ''; } return sprintf( '
' . '%s' . '
' . '
%s
' . '
' . '
', $q, $a ); } public function enqueue_editor_assets(): void { // Shared panels module — same file Classic Editor loads. Must enqueue // before the sidebar shell since the shell consumes window.AeomaticPanels. wp_enqueue_script( 'aeomatic-panels', AEOMATIC_URL . 'assets/js/aeomatic-panels.js', array( 'wp-element', 'wp-components', 'wp-data', 'wp-i18n', 'wp-api-fetch' ), AEOMATIC_VERSION, true ); wp_set_script_translations( 'aeomatic-panels', 'aeomatic' ); // Gutenberg PluginSidebar shell. wp_enqueue_script( 'aeob-editor-sidebar', AEOMATIC_URL . 'assets/js/editor-sidebar.js', // wp-editor: the Plugin* slots moved there in WordPress 6.6. array( 'aeomatic-panels', 'wp-plugins', 'wp-edit-post', 'wp-editor' ), AEOMATIC_VERSION, true ); wp_set_script_translations( 'aeob-editor-sidebar', 'aeomatic' ); } }