__( 'Contents of the current singular post.', 'tocnest' ) ) ); } /** * Render in classic widget areas. * * @param array $args Theme wrappers. * @param array $instance Saved instance. */ public function widget( $args, $instance ) { if ( ! is_singular() ) { return; } $html = Tocnest_Renderer::render( array(), get_queried_object() ); if ( $html ) { echo $args['before_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Trusted theme wrapper supplied by WordPress. echo $html; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Shared renderer escapes every dynamic attribute and text value. echo $args['after_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Trusted theme wrapper supplied by WordPress. } } /** * Explain that global settings apply. * * @param array $instance Saved instance. * @return string */ public function form( $instance ) { echo '
' . esc_html__( 'Uses Tocnest settings and the current singular post. For individual options, use the Tocnest block.', 'tocnest' ) . '
'; return ''; } /** * No instance-specific configuration is stored. * * @param array $new_instance Submitted values. * @param array $old_instance Previous values. * @return array */ public function update( $new_instance, $old_instance ) { return array(); } }