Changeset 58187 for trunk/src/wp-includes/blocks/navigation-link.php
- Timestamp:
- 05/23/2024 07:37:08 PM (9 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/blocks/navigation-link.php
r57663 r58187 9 9 * Build an array with CSS classes and inline styles defining the colors 10 10 * which will be applied to the navigation markup in the front-end. 11 * 12 * @since 5.9.0 11 13 * 12 14 * @param array $context Navigation block context. … … 79 81 * Build an array with CSS classes and inline styles defining the font sizes 80 82 * which will be applied to the navigation markup in the front-end. 83 * 84 * @since 5.9.0 81 85 * 82 86 * @param array $context Navigation block context. … … 114 118 * Returns the top-level submenu SVG chevron icon. 115 119 * 120 * @since 5.9.0 121 * 116 122 * @return string 117 123 */ … … 122 128 /** 123 129 * Decodes a url if it's encoded, returning the same url if not. 130 * 131 * @since 6.2.0 124 132 * 125 133 * @param string $url The url to decode. … … 153 161 /** 154 162 * Renders the `core/navigation-link` block. 163 * 164 * @since 5.9.0 155 165 * 156 166 * @param array $attributes The block attributes. … … 188 198 $kind = empty( $attributes['kind'] ) ? 'post_type' : str_replace( '-', '_', $attributes['kind'] ); 189 199 $is_active = ! empty( $attributes['id'] ) && get_queried_object_id() === (int) $attributes['id'] && ! empty( get_queried_object()->$kind ); 200 201 if ( is_post_type_archive() ) { 202 $queried_archive_link = get_post_type_archive_link( get_queried_object()->name ); 203 if ( $attributes['url'] === $queried_archive_link ) { 204 $is_active = true; 205 } 206 } 190 207 191 208 $wrapper_attributes = get_block_wrapper_attributes( … … 269 286 /** 270 287 * Returns a navigation link variation 288 * 289 * @since 5.9.0 271 290 * 272 291 * @param WP_Taxonomy|WP_Post_Type $entity post type or taxonomy entity. … … 392 411 * Registers the navigation link block. 393 412 * 413 * @since 5.9.0 414 * 394 415 * @uses render_block_core_navigation_link() 395 416 * @throws WP_Error An WP_Error exception parsing the block definition.
Note: See TracChangeset
for help on using the changeset viewer.