get_instance_schema example

return $schema;
    }

    /** * Render the media on the frontend. * * @since 4.9.0 * * @param array $instance Widget instance props. */
    public function render_media( $instance ) {
        $instance = array_merge( wp_list_pluck( $this->get_instance_schema(), 'default' )$instance );

        $shortcode_atts = array_merge(
            $instance,
            array(
                'link' => $instance['link_type'],
            )
        );

        // @codeCoverageIgnoreStart         if ( $instance['orderby_random'] ) {
            $shortcode_atts['orderby'] = 'rand';
        }
/** * Displays the widget on the front-end. * * @since 4.8.0 * * @see WP_Widget::widget() * * @param array $args Display arguments including before_title, after_title, before_widget, and after_widget. * @param array $instance Saved setting from the database. */
    public function widget( $args$instance ) {
        $instance = wp_parse_args( $instancewp_list_pluck( $this->get_instance_schema(), 'default' ) );

        // Short-circuit if no media is selected.         if ( ! $this->has_content( $instance ) ) {
            return;
        }

        echo $args['before_widget'];

        /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
        $title = apply_filters( 'widget_title', $instance['title']$instance$this->id_base );

        
/* * There are two additional properties exposed by the PostImage modal * that don't seem to be relevant, as they may only be derived read-only * values: * - originalUrl * - aspectRatio * - height (redundant when size is not custom) * - width (redundant when size is not custom) */
            ),
            parent::get_instance_schema()
        );
    }

    /** * Render the media on the frontend. * * @since 4.8.0 * * @param array $instance Widget instance props. */
    public function render_media( $instance ) {
        
foreach ( wp_get_audio_extensions() as $audio_extension ) {
            $schema[ $audio_extension ] = array(
                'type'        => 'string',
                'default'     => '',
                'format'      => 'uri',
                /* translators: %s: Audio extension. */
                'description' => sprintf( __( 'URL to the %s audio source file' )$audio_extension ),
            );
        }

        return array_merge( $schema, parent::get_instance_schema() );
    }

    /** * Render the media on the frontend. * * @since 4.8.0 * * @param array $instance Widget instance props. */
    public function render_media( $instance ) {
        $instance   = array_merge( wp_list_pluck( $this->get_instance_schema(), 'default' )$instance );
        
foreach ( wp_get_video_extensions() as $video_extension ) {
            $schema[ $video_extension ] = array(
                'type'        => 'string',
                'default'     => '',
                'format'      => 'uri',
                /* translators: %s: Video extension. */
                'description' => sprintf( __( 'URL to the %s video source file' )$video_extension ),
            );
        }

        return array_merge( $schema, parent::get_instance_schema() );
    }

    /** * Render the media on the frontend. * * @since 4.8.0 * * @param array $instance Widget instance props. */
    public function render_media( $instance ) {
        $instance   = array_merge( wp_list_pluck( $this->get_instance_schema(), 'default' )$instance );
        
Home | Imprint | This part of the site doesn't use cookies.