PluginProbe ʕ •ᴥ•ʔ
Kubio AI Page Builder / 2.8.2
Kubio AI Page Builder v2.8.2
2.8.4 2.8.3 2.8.2 2.8.1 trunk 1.0.0 1.0.1 1.1.0 1.2.0 1.2.1 1.2.2 1.2.3 1.3.0 1.3.1 1.3.2 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.7.0 1.7.1 1.7.2 1.7.3 1.8.0 1.8.1 1.8.2 1.9.0 2.0.0 2.1.1 2.1.2 2.1.3 2.2.0 2.2.3 2.2.4 2.2.5 2.3.0 2.3.1 2.3.3 2.3.4 2.4.0 2.4.1 2.4.2 2.4.3 2.4.5 2.5.0 2.5.1 2.5.2 2.5.3 2.6.0 2.6.1 2.6.2 2.6.3 2.6.5 2.6.6 2.6.7 2.7.0 2.7.1 2.7.2 2.7.3 2.8.0
kubio / build / block-library / blocks / menu / dropdown-menu / index.php
kubio / build / block-library / blocks / menu / dropdown-menu Last commit date
block.json 4 years ago index.php 1 year ago
index.php
64 lines
1 <?php
2
3 namespace Kubio\Blocks;
4
5 use Kubio\Core\Blocks\BlockBase;
6 use Kubio\Core\Registry;
7 use Kubio\Core\Utils;
8
9
10 class DropDownMenuBlock extends BlockBase {
11 const BLOCK_NAME = 'kubio/dropdown-menu';
12
13 public function mapPropsToElements() {
14
15 $effect = $this->getProp( 'hoverEffect.type' ) === 'none' ? false : $this->getProp( 'hoverEffect.type' );
16
17 $border_effect = $this->isLineEffect( $effect ) ? $this->getProp( 'hoverEffect.border.effect' ) : false;
18
19 $background_effect = $this->isBackgroundEffect( $effect ) ? $this->getProp( 'hoverEffect.background.effect' ) : false;
20
21 $effect_classes = array( $effect, $border_effect, $background_effect );
22 $effect_classes = array_filter(
23 $effect_classes,
24 function ( $item ) {
25 return ! ! $item;
26 }
27 );
28
29 $jsProps = Utils::useJSComponentProps( 'dropdown-menu' );
30
31 return array(
32 'outer' => array_merge(
33 $jsProps,
34 array(
35 'className' => array_merge(
36 array(
37 'kubio-dropdown-menu',
38 $this->getAttribute( 'showOffscreenMenuOn', 'has-offcanvas-mobile' ),
39 ),
40 $effect_classes
41 ),
42 )
43 ),
44 );
45 }
46
47 private function isLineEffect( $effect ) {
48 return ( $effect && strpos( $effect, 'bordered-active-item' ) !== false );
49 }
50
51 private function isBackgroundEffect( $effect ) {
52 return ( $effect && strpos( $effect, 'solid-active-item' ) !== false );
53 }
54 }
55
56
57 Registry::registerBlock(
58 __DIR__,
59 DropDownMenuBlock::class,
60 array(
61 'metadata_mixins' => array( '../menu-items-block-json-partial.json' ),
62 )
63 );
64