Skip to content

Commit

Permalink
Set mininumVisibility to private per recommendation from @azaozz.
Browse files Browse the repository at this point in the history
  • Loading branch information
anton-vlasenko authored and Anton Vlasenko committed Apr 4, 2024
1 parent b69db71 commit 19a7cf2
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 3 deletions.
44 changes: 44 additions & 0 deletions packages/block-library/src/navigation/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@ class WP_Navigation_Block_Renderer {

/**
* Used to determine whether or not a navigation has submenus.
*
* @since 6.5.0
*/
private static $has_submenus = false;

/**
* Used to determine which blocks need an <li> wrapper.
*
* @since 6.5.0
*
* @var array
*/
private static $needs_list_item_wrapper = array(
Expand All @@ -30,13 +34,17 @@ class WP_Navigation_Block_Renderer {
/**
* Keeps track of all the navigation names that have been seen.
*
* @since 6.5.0
*
* @var array
*/
private static $seen_menu_names = array();

/**
* Returns whether or not this is responsive navigation.
*
* @since 6.5.0
*
* @param array $attributes The block attributes.
* @return bool Returns whether or not this is responsive navigation.
*/
Expand All @@ -52,6 +60,8 @@ private static function is_responsive( $attributes ) {
/**
* Returns whether or not a navigation has a submenu.
*
* @since 6.5.0
*
* @param WP_Block_List $inner_blocks The list of inner blocks.
* @return bool Returns whether or not a navigation has a submenu and also sets the member variable.
*/
Expand Down Expand Up @@ -89,6 +99,8 @@ private static function has_submenus( $inner_blocks ) {
/**
* Determine whether the navigation blocks is interactive.
*
* @since 6.5.0
*
* @param array $attributes The block attributes.
* @param WP_Block_List $inner_blocks The list of inner blocks.
* @return bool Returns whether or not to load the view script.
Expand All @@ -102,6 +114,8 @@ private static function is_interactive( $attributes, $inner_blocks ) {
/**
* Returns whether or not a block needs a list item wrapper.
*
* @since 6.5.0
*
* @param WP_Block $block The block.
* @return bool Returns whether or not a block needs a list item wrapper.
*/
Expand All @@ -128,6 +142,8 @@ private static function does_block_need_a_list_item_wrapper( $block ) {
/**
* Returns the markup for a single inner block.
*
* @since 6.5.0
*
* @param WP_Block $inner_block The inner block.
* @return string Returns the markup for a single inner block.
*/
Expand All @@ -145,6 +161,8 @@ private static function get_markup_for_inner_block( $inner_block ) {
/**
* Returns the html for the inner blocks of the navigation block.
*
* @since 6.5.0
*
* @param array $attributes The block attributes.
* @param WP_Block_List $inner_blocks The list of inner blocks.
* @return string Returns the html for the inner blocks of the navigation block.
Expand Down Expand Up @@ -202,6 +220,8 @@ private static function get_inner_blocks_html( $attributes, $inner_blocks ) {
/**
* Gets the inner blocks for the navigation block from the navigation post.
*
* @since 6.5.0
*
* @param array $attributes The block attributes.
* @return WP_Block_List Returns the inner blocks for the navigation block.
*/
Expand Down Expand Up @@ -237,6 +257,8 @@ private static function get_inner_blocks_from_navigation_post( $attributes ) {
/**
* Gets the inner blocks for the navigation block from the fallback.
*
* @since 6.5.0
*
* @param array $attributes The block attributes.
* @return WP_Block_List Returns the inner blocks for the navigation block.
*/
Expand All @@ -254,6 +276,8 @@ private static function get_inner_blocks_from_fallback( $attributes ) {
/**
* Gets the inner blocks for the navigation block.
*
* @since 6.5.0
*
* @param array $attributes The block attributes.
* @param WP_Block $block The parsed block.
* @return WP_Block_List Returns the inner blocks for the navigation block.
Expand Down Expand Up @@ -312,6 +336,8 @@ private static function get_inner_blocks( $attributes, $block ) {
/**
* Gets the name of the current navigation, if it has one.
*
* @since 6.5.0
*
* @param array $attributes The block attributes.
* @return string Returns the name of the navigation.
*/
Expand Down Expand Up @@ -347,6 +373,8 @@ private static function get_navigation_name( $attributes ) {
/**
* Returns the layout class for the navigation block.
*
* @since 6.5.0
*
* @param array $attributes The block attributes.
* @return string Returns the layout class for the navigation block.
*/
Expand Down Expand Up @@ -378,6 +406,8 @@ private static function get_layout_class( $attributes ) {
/**
* Return classes for the navigation block.
*
* @since 6.5.0
*
* @param array $attributes The block attributes.
* @return string Returns the classes for the navigation block.
*/
Expand Down Expand Up @@ -405,6 +435,8 @@ private static function get_classes( $attributes ) {
/**
* Get styles for the navigation block.
*
* @since 6.5.0
*
* @param array $attributes The block attributes.
* @return string Returns the styles for the navigation block.
*/
Expand All @@ -418,6 +450,8 @@ private static function get_styles( $attributes ) {
/**
* Get the responsive container markup
*
* @since 6.5.0
*
* @param array $attributes The block attributes.
* @param WP_Block_List $inner_blocks The list of inner blocks.
* @param string $inner_blocks_html The markup for the inner blocks.
Expand Down Expand Up @@ -516,6 +550,8 @@ private static function get_responsive_container_markup( $attributes, $inner_blo
/**
* Get the wrapper attributes
*
* @since 6.5.0
*
* @param array $attributes The block attributes.
* @param WP_Block_List $inner_blocks A list of inner blocks.
* @return string Returns the navigation block markup.
Expand Down Expand Up @@ -545,6 +581,8 @@ private static function get_nav_wrapper_attributes( $attributes, $inner_blocks )
/**
* Gets the nav element directives.
*
* @since 6.5.0
*
* @param bool $is_interactive Whether the block is interactive.
* @return string the directives for the navigation element.
*/
Expand Down Expand Up @@ -575,6 +613,8 @@ private static function get_nav_element_directives( $is_interactive ) {
/**
* Handle view script module loading.
*
* @since 6.5.0
*
* @param array $attributes The block attributes.
* @param WP_Block $block The parsed block.
* @param WP_Block_List $inner_blocks The list of inner blocks.
Expand All @@ -599,6 +639,8 @@ private static function handle_view_script_module_loading( $attributes, $block,
/**
* Returns the markup for the navigation block.
*
* @since 6.5.0
*
* @param array $attributes The block attributes.
* @param WP_Block_List $inner_blocks The list of inner blocks.
* @return string Returns the navigation wrapper markup.
Expand All @@ -614,6 +656,8 @@ private static function get_wrapper_markup( $attributes, $inner_blocks ) {
/**
* Returns a unique name for the navigation.
*
* @since 6.5.0
*
* @param array $attributes The block attributes.
* @return string Returns a unique name for the navigation.
*/
Expand Down
3 changes: 0 additions & 3 deletions phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,5 @@
<include-pattern>/packages/block-serialization-default-parser/.+/*\.php$</include-pattern>
<include-pattern>/packages/widgets/src/blocks/legacy-widget/index\.php$</include-pattern>
<include-pattern>/packages/widgets/src/blocks/widget-group/index\.php$</include-pattern>
<properties>
<property name="minimumVisibility" value="protected" />
</properties>
</rule>
</ruleset>

0 comments on commit 19a7cf2

Please sign in to comment.