esc_html__( 'All categories', 'accordion-faq-plugin' ) ); $terms = get_terms( array( 'taxonomy' => \AccordionFaq\Setup\Taxonomy::TAXONOMY, 'hide_empty' => false ) ); if ( ! is_wp_error( $terms ) ) { foreach ( $terms as $term ) { $options[ $term->slug ] = $term->name; } } $this->controls['category'] = array( 'tab' => 'content', 'label' => esc_html__( 'Category', 'accordion-faq-plugin' ), 'type' => 'select', 'options' => $options, 'clearable' => false, ); $this->controls['style'] = array( 'tab' => 'content', 'label' => esc_html__( 'Style', 'accordion-faq-plugin' ), 'type' => 'select', 'options' => array( '' => esc_html__( 'Default (from settings)', 'accordion-faq-plugin' ), 'modern' => esc_html__( 'Modern', 'accordion-faq-plugin' ), 'card' => esc_html__( 'Card', 'accordion-faq-plugin' ), 'bordered' => esc_html__( 'Bordered', 'accordion-faq-plugin' ), 'filled' => esc_html__( 'Filled', 'accordion-faq-plugin' ), 'separated' => esc_html__( 'Separated', 'accordion-faq-plugin' ), 'minimal' => esc_html__( 'Minimal', 'accordion-faq-plugin' ), ), ); $this->controls['search'] = array( 'tab' => 'content', 'label' => esc_html__( 'Show search', 'accordion-faq-plugin' ), 'type' => 'checkbox' ); $this->controls['filter'] = array( 'tab' => 'content', 'label' => esc_html__( 'Show category filter', 'accordion-faq-plugin' ), 'type' => 'checkbox' ); $this->controls['expandAll'] = array( 'tab' => 'content', 'label' => esc_html__( 'Show expand / collapse all', 'accordion-faq-plugin' ), 'type' => 'checkbox' ); $this->controls['toc'] = array( 'tab' => 'content', 'label' => esc_html__( 'Show table of contents', 'accordion-faq-plugin' ), 'type' => 'checkbox' ); } /** * Render the element. * * @return void */ public function render() { $s = $this->settings; $args = array( 'category' => isset( $s['category'] ) ? (string) $s['category'] : '', 'style' => isset( $s['style'] ) ? (string) $s['style'] : '', 'search' => ! empty( $s['search'] ), 'filter' => ! empty( $s['filter'] ), 'expand_all' => ! empty( $s['expandAll'] ), 'toc' => ! empty( $s['toc'] ), ); $html = accordion_faq()->renderer()->render( $args ); if ( '' === $html ) { $html = '

' . esc_html__( 'No FAQs found.', 'accordion-faq-plugin' ) . '

'; } // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- renderer output is pre-escaped/template-built; $root_classes is Bricks-generated. echo "
render_attributes( '_root' )}>" . $html . '
'; } }