render_block_core_navigation_overlay_close( array $attributes ): string
- Since
- 7.0.0
- Source
wp-includes/blocks/navigation-overlay-close.php:17
core/navigation-overlay-close block on server.Compatibility
- WordPress
- since 7.0.0
- PHP
- 7.4–8.6-dev
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in 2 of the 5 tracked releases, added in 7.0.0, and compiles on PHP 7.4 through 8.6-dev.
Parameters
$attributesarray- The block attributes.
Return value
string- Returns the block content.
Performance profile
How much work a call to render_block_core_navigation_overlay_close() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.
- Cost class
- Trivial
- Scaling
- Constant
- Instructions
- 31–50
- Plugin surface
- None
- Called by
- 0
Touches nothing outside its own arguments.
No loop in the body: the same number of instructions runs whatever you pass in.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 53.
Nothing here hands control to plugin code.
Nothing in core calls this; the cost is only what you spend yourself.
What one call costs · 8 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost render_block_core_navigation_overlay_close() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
!empty($attributes) | 31–35 | get_block_wrapper_attributes(), sprintf() |
empty($attributes) | 35–39 | __(), get_block_wrapper_attributes(), sprintf() |
!empty($attributes) | 36–40 | get_block_wrapper_attributes(), __(), sprintf() |
!empty($attributes) | 37–41 | wp_kses_post(), get_block_wrapper_attributes(), sprintf() |
empty($attributes) | 40–44 | __(), get_block_wrapper_attributes(), __(), sprintf() |
empty($attributes) | 41–45 | __(), wp_kses_post(), get_block_wrapper_attributes(), sprintf() |
!empty($attributes) | 42–46 | wp_kses_post(), get_block_wrapper_attributes(), __(), sprintf() |
empty($attributes) | 46–50 | __(), wp_kses_post(), get_block_wrapper_attributes(), __(), sprintf() |
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 52 | 31–49 | 7 | 1 fewer instruction than PHP 8.5 |
| 8.5 | 53 | 31–50 | 7 | |
| 8.4 | 53 | 31–50 | 7 | |
| 8.3 | 53 | 31–50 | 7 | |
| 8.2 | 53 | 31–50 | 7 | |
| 8.1 | 53 | 31–50 | 7 | 3 fewer instructions than PHP 7.4 |
| 7.4 | 56 | 33–51 | 7 |
An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.
Uses · 3
- __()Retrieves the translation of $text.
- wp_kses_post()Sanitizes content for allowed HTML tags for post content.
- get_block_wrapper_attributes()Generates a string of attributes by applying to the current block being rendered all of the features that the block supports.
Source code
function render_block_core_navigation_overlay_close( $attributes ) { $text = empty( $attributes['text'] ) ? __( 'Close' ) : $attributes['text']; $display_mode = empty( $attributes['displayMode'] ) ? 'icon' : $attributes['displayMode']; $show_icon = 'both' === $display_mode || 'icon' === $display_mode; $show_text = 'both' === $display_mode || 'text' === $display_mode; $button_text = ''; if ( $show_icon ) { $button_text .= '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24" aria-hidden="true" focusable="false"><path d="M13 11.8l6.1-6.3-1.1-1-6.1 6.2-6.1-6.2-1.1 1 6.1 6.3-6.5 6.7 1.1 1 6.5-6.6 6.5 6.6 1.1-1z" /></svg>'; } if ( $show_text ) { $button_text .= '<span class="wp-block-navigation-overlay-close__text">' . wp_kses_post( $text ) . '</span>'; } $wrapper_attributes = get_block_wrapper_attributes(); $html_content = sprintf( '<button %1$s type="button" %2$s >%3$s</button>', $wrapper_attributes, ! $show_text ? 'aria-label="' . __( 'Close' ) . '"' : '', $button_text ); return $html_content;}Changelog
Introduced in 7.0.0. Unchanged from 7.0.4 through 7.1.0.
Signature, return type and hooks compared across 2 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, from
src/wp-includes/blocks/navigation-overlay-close.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.