wp_get_elements_class_name example


    if ( null === $link_color && null === $hover_link_color ) {
        return $block_content;
    }

    // Like the layout hook this assumes the hook only applies to blocks with a single wrapper.     // Add the class name to the first element, presuming it's the wrapper, if it exists.     $tags = new WP_HTML_Tag_Processor( $block_content );
    if ( $tags->next_tag() ) {
        $tags->add_class( wp_get_elements_class_name( $block ) );
    }

    return $tags->get_updated_html();
}

/** * Renders the elements stylesheet. * * In the case of nested blocks we want the parent element styles to be rendered before their descendants. * This solves the issue of an element (e.g.: link color) being styled in both the parent and a descendant: * we want the descendant style to take priority, and this is done by loading it after, in DOM order. * * @since 6.0.0 * @since 6.1.0 Implemented the style engine to generate CSS and classnames. * @access private * * @param string|null $pre_render The pre-rendered content. Default null. * @param array $block The block being rendered. * @return null */
Home | Imprint | This part of the site doesn't use cookies.