__( 'A collapsible archive with on-demand post titles.', 'content-trees' ), ) ); } /** * Render the widget using theme wrappers. * * @param array $args Tree options or theme widget wrappers. * @param array $instance Saved widget settings. */ public function widget( $args, $instance ) { $options = archive_options( $instance ); $title = $options['title']; $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Theme-owned HTML from register_sidebar()/dynamic_sidebar(); not a saved widget field. echo $args['before_widget']; if ( '' !== $title ) { // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Theme-owned opening title markup; the filtered title is escaped separately below. echo $args['before_title']; echo esc_html( $title ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Theme-owned closing title markup from the registered sidebar. echo $args['after_title']; } $options['title'] = $title; $options['show_title'] = false; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- render() escapes text, attributes and URLs while constructing its HTML. echo render( $options ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Theme-owned closing widget markup from the registered sidebar. echo $args['after_widget']; } /** * Render the classic widget settings. * * @param array $instance Saved widget settings. */ public function form( $instance ) { $options = archive_options( $instance ); $title = $options['title']; ?>

__( 'Show individual posts', 'content-trees' ), 'group_years' => __( 'Group months by year', 'content-trees' ), ) as $key => $label ) : ?>

>

>

>

>

>

>

sanitize_text_field( $new_instance['title'] ?? '' ), 'show_counts' => enabled( $new_instance['show_counts'] ?? false ), 'show_archive_links' => enabled( $new_instance['show_archive_links'] ?? false ), 'show_controls' => enabled( $new_instance['show_controls'] ?? false ), 'auto_open' => enabled( $new_instance['auto_open'] ?? false ), 'show_posts' => enabled( $new_instance['show_posts'] ?? false ), 'group_years' => enabled( $new_instance['group_years'] ?? false ), 'close_siblings' => enabled( $new_instance['close_siblings'] ?? false ), 'order' => archive_order( $new_instance['order'] ?? 'DESC' ), 'excluded_posts' => exclusion_ids( $new_instance['excluded_posts'] ?? array() ), ); } }