meta( 'permanently_locked', true ); } /** * @return bool */ protected function is_atomic_container(): bool { return false; } /** * {@inheritdoc} */ public static function get_element_type(): string { return Smart_Menu::TYPE_ITEM; } /** * {@inheritdoc} */ public function get_title() { return __( 'Menu Item', 'reactwoo-atomic' ); } /** * {@inheritdoc} */ public function get_icon() { return 'eicon-nav-menu'; } /** * {@inheritdoc} */ protected function should_show_in_panel() { return false; } /** * {@inheritdoc} */ protected function define_allowed_child_types() { return array( Smart_Menu::TYPE_LINK, Smart_Menu::TYPE_PANEL ); } /** * Hug content — Elementor Atomic often forces width:100% on nestables. * * {@inheritdoc} */ protected function define_base_styles(): array { return array( static::BASE_STYLE_KEY => Style_Definition::make() ->add_variant( Style_Variant::make() ->add_props( array( 'display' => String_Prop_Type::generate( 'flex' ), 'align-self' => String_Prop_Type::generate( 'flex-start' ), 'width' => String_Prop_Type::generate( 'auto' ), 'flex-grow' => String_Prop_Type::generate( '0' ), 'flex-shrink' => String_Prop_Type::generate( '0' ), ) ) ), ); } /** * {@inheritdoc} */ protected function get_templates(): array { return array( 'reactwoo-atomic/smart-menu-item' => __DIR__ . '/templates/smart-menu-item.html.twig', ); } /** * {@inheritdoc} */ protected function build_template_context(): array { $has_panel = false; if ( method_exists( $this, 'get_children' ) ) { foreach ( (array) $this->get_children() as $child ) { if ( is_object( $child ) && method_exists( $child, 'get_type' ) && Smart_Menu::TYPE_PANEL === $child->get_type() ) { $has_panel = true; break; } } } return array_merge( $this->build_base_template_context(), array( 'has_panel' => $has_panel, ) ); } }