wpseek.com
WordPress开发者和主题制作者的搜索引擎
block_core_page_list_get_submenu_visibility › WordPress Function
Since7.0.0
已弃用n/a
› block_core_page_list_get_submenu_visibility ( $context )
| 参数: |
|
| 返回: |
|
| 定义在: |
|
| 文档: |
Returns the submenu visibility value with backward compatibility for the deprecated openSubmenusOnClick attribute.
源码
function block_core_page_list_get_submenu_visibility( $context ) {
$deprecated_open_submenus_on_click = $context['openSubmenusOnClick'] ?? null;
// For backward compatibility, prioritize the legacy attribute if present. If it has been loaded and saved in the editor, then
// the deprecated attribute will be replaced by submenuVisibility.
if ( null !== $deprecated_open_submenus_on_click ) {
// Convert boolean to string: true -> 'click', false -> 'hover'.
return ! empty( $deprecated_open_submenus_on_click ) ? 'click' : 'hover';
}
$submenu_visibility = $context['submenuVisibility'] ?? null;
// Use submenuVisibility for migrated/new blocks.
return $submenu_visibility ?? 'hover';
}