Changeset 53157 for trunk/src/wp-includes/blocks/navigation-submenu.php
- Timestamp:
- 04/12/2022 03:10:30 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/blocks/navigation-submenu.php
r52551 r53157 111 111 */ 112 112 function block_core_navigation_submenu_render_submenu_icon() { 113 return '<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none" role="img"aria-hidden="true" focusable="false"><path d="M1.50002 4L6.00002 8L10.5 4" stroke-width="1.5"></path></svg>';113 return '<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none" aria-hidden="true" focusable="false"><path d="M1.50002 4L6.00002 8L10.5 4" stroke-width="1.5"></path></svg>'; 114 114 } 115 115 … … 117 117 * Renders the `core/navigation-submenu` block. 118 118 * 119 * @param array $attributes The block attributes.120 * @param string $contentThe saved content.121 * @param object $blockThe parsed block.119 * @param array $attributes The block attributes. 120 * @param string $content The saved content. 121 * @param WP_Block $block The parsed block. 122 122 * 123 123 * @return string Returns the post content with the legacy widget added. … … 168 168 169 169 if ( isset( $attributes['label'] ) ) { 170 $label .= wp_kses( 171 $attributes['label'], 172 array( 173 'code' => array(), 174 'em' => array(), 175 'img' => array( 176 'scale' => array(), 177 'class' => array(), 178 'style' => array(), 179 'src' => array(), 180 'alt' => array(), 181 ), 182 's' => array(), 183 'span' => array( 184 'style' => array(), 185 ), 186 'strong' => array(), 187 ) 188 ); 170 $label .= wp_kses_post( $attributes['label'] ); 189 171 } 190 172 … … 200 182 // If submenu icons are set to show, we also render a submenu button, so the submenu can be opened on click. 201 183 if ( ! $open_on_click ) { 202 $item_url = isset( $attributes['url'] ) ? esc_url( $attributes['url'] ): '';184 $item_url = isset( $attributes['url'] ) ? $attributes['url'] : ''; 203 185 // Start appending HTML attributes to anchor tag. 204 $html .= '<a class="wp-block-navigation-item__content" href="' . $item_url. '"';186 $html .= '<a class="wp-block-navigation-item__content" href="' . esc_url( $item_url ) . '"'; 205 187 206 188 if ( $is_active ) { … … 233 215 // The submenu icon is rendered in a button here 234 216 // so that there's a clickable element to open the submenu. 235 $html .= '<button aria-label="' . $aria_label. '" class="wp-block-navigation__submenu-icon wp-block-navigation-submenu__toggle" aria-expanded="false">' . block_core_navigation_submenu_render_submenu_icon() . '</button>';217 $html .= '<button aria-label="' . esc_attr( $aria_label ) . '" class="wp-block-navigation__submenu-icon wp-block-navigation-submenu__toggle" aria-expanded="false">' . block_core_navigation_submenu_render_submenu_icon() . '</button>'; 236 218 } 237 219 } else { 238 220 // If menus open on click, we render the parent as a button. 239 $html .= '<button aria-label="' . $aria_label. '" class="wp-block-navigation-item__content wp-block-navigation-submenu__toggle" aria-expanded="false">';221 $html .= '<button aria-label="' . esc_attr( $aria_label ) . '" class="wp-block-navigation-item__content wp-block-navigation-submenu__toggle" aria-expanded="false">'; 240 222 241 223 // Wrap title with span to isolate it from submenu icon. … … 246 228 $html .= '</span>'; 247 229 230 $html .= '</button>'; 231 248 232 $html .= '<span class="wp-block-navigation__submenu-icon">' . block_core_navigation_submenu_render_submenu_icon() . '</span>'; 249 250 $html .= '</button>';251 233 252 234 }
Note: See TracChangeset
for help on using the changeset viewer.