prepare_attributes_for_render example


    public function render( $attributes = array()$content = '' ) {
        if ( ! $this->is_dynamic() ) {
            return '';
        }

        $attributes = $this->prepare_attributes_for_render( $attributes );

        return (string) call_user_func( $this->render_callback, $attributes$content );
    }

    /** * Returns true if the block type is dynamic, or false otherwise. A dynamic * block is one which defers its rendering to occur on-demand at runtime. * * @since 5.0.0 * * @return bool Whether block type is dynamic. */

    public function __get( $name ) {
        if ( 'attributes' === $name ) {
            $this->attributes = isset( $this->parsed_block['attrs'] ) ?
                $this->parsed_block['attrs'] :
                array();

            if ( ! is_null( $this->block_type ) ) {
                $this->attributes = $this->block_type->prepare_attributes_for_render( $this->attributes );
            }

            return $this->attributes;
        }

        return null;
    }

    /** * Generates the render output for the block. * * @since 5.5.0 * * @global WP_Post $post Global post object. * * @param array $options { * Optional options object. * * @type bool $dynamic Defaults to 'true'. Optionally set to false to avoid using the block's render_callback. * } * @return string Rendered block output. */
Home | Imprint | This part of the site doesn't use cookies.