PluginProbe
Gutenify – Visual Site Builder Blocks & Starter Templates / 1.0.9
Gutenify – Visual Site Builder Blocks & Starter Templates v1.0.9
1.9.0 1.8.0 1.7.0 1.6.6 1.6.5 1.6.4 trunk 0.0.1 0.0.2 0.0.3 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 All 74 releases
gutenify / src / blocks / _temp / navigation-menu / index.php

index.php in Gutenify – Visual Site Builder Blocks & Starter Templates 1.0.9, at src/blocks/_temp/navigation-menu/index.php

78 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Server-side rendering of the `gutenify/section-title` block.
4 *
5 * @package WordPress
6 */
7
8 /**
9 * Renders the `gutenify/section-title` block on the server.
10 *
11 * @param array $attributes Block attributes.
12 *
13 * @return string Returns the filtered post title for the current post wrapped inside "h1" tags.
14 */
15 function gutenify_render_block_navigation_menu( $attributes ) {
16 $content_justification = ! empty( $attributes['contentJustification'] ) ? 'is-content-justification-' . $attributes['contentJustification'] : '';
17 ob_start();
18 if ( has_nav_menu( 'primary' ) ) : ?>
19 <div class="wp-block-gutenify-navitation-menu <?php echo esc_attr( $content_justification ); ?>">
20 <div class="gutenify-navitation-menu-section">
21 <nav id="site-navigation" class="primary-navigation" role="navigation" aria-label="<?php esc_attr_e( 'Primary menu', 'hello-gutenify' ); ?>">
22 <div class="menu-button-container">
23 <button id="primary-mobile-menu" class="button" aria-controls="primary-menu-list" aria-expanded="false">
24 <span class="dropdown-icon open">
25 <i class="ion-navicon-round"></i>
26 </span>
27 <span class="dropdown-icon close">
28 <i class="ion-close"></i>
29 </span>
30 </button><!-- #primary-mobile-menu -->
31 </div><!-- .menu-button-container -->
32 <?php
33 wp_nav_menu(
34 array(
35 'theme_location' => 'primary',
36 'menu_class' => 'menu-wrapper',
37 'container_class' => 'primary-menu-container',
38 'items_wrap' => '<ul id="primary-menu-list" class="%2$s">%3$s</ul>',
39 'fallback_cb' => false,
40 )
41 );
42 ?>
43 </nav><!-- #site-navigation -->
44 </div>
45 </div>
46 <?php
47 endif;
48 $output = ob_get_contents();
49 ob_end_clean();
50 return $output;
51 }
52
53 /**
54 * Registers the `gutenify/section-title` block on the server.
55 */
56 function gutenify_register_block_navigation_menu() {
57 // Return early if this function does not exist.
58 if ( ! function_exists( 'register_block_type' ) ) {
59 return;
60 }
61
62 // Load attributes from block.json.
63 ob_start();
64 include GUTENIFY_PLUGIN_DIR . 'src/blocks/section-title/block.json';
65 $metadata = json_decode( ob_get_clean(), true );
66 register_block_type(
67 'gutenify/navigation-menu',
68 array(
69 'render_callback' => 'gutenify_render_block_navigation_menu',
70 'editor_script' => 'gutenify-editor',
71 'editor_style' => 'gutenify-editor',
72 'style' => 'gutenify-frontend',
73 'attributes' => $metadata['attributes'],
74 )
75 );
76 }
77 add_action( 'init', 'gutenify_register_block_navigation_menu' );
78