elementor
/
modules
/
atomic-widgets
/
elements
/
atomic-list
/
atomic-list-item-content
/
atomic-list-item-content.php
atomic-list-item-content.php in Elementor Website Builder – more than just a page builder 4.3.2, at modules/atomic-widgets/elements/atomic-list/atomic-list-item-content/atomic-list-item-content.php
| 1 | <?php |
| 2 | namespace Elementor\Modules\AtomicWidgets\Elements\Atomic_List\Atomic_List_Item_Content; |
| 3 | |
| 4 | use Elementor\Modules\AtomicWidgets\Controls\Section; |
| 5 | use Elementor\Modules\AtomicWidgets\Elements\Atomic_Paragraph\Atomic_Paragraph; |
| 6 | use Elementor\Modules\AtomicWidgets\Elements\Base\Atomic_Element_Base; |
| 7 | use Elementor\Modules\AtomicWidgets\Elements\Base\Has_Element_Template; |
| 8 | use Elementor\Modules\AtomicWidgets\Elements\Base\Html_Tag_Computer; |
| 9 | use Elementor\Modules\AtomicWidgets\PropTypes\Attributes_Prop_Type; |
| 10 | use Elementor\Modules\AtomicWidgets\PropTypes\Classes_Prop_Type; |
| 11 | use Elementor\Modules\AtomicWidgets\PropTypes\Escaped_Html_Prop_Type; |
| 12 | use Elementor\Modules\AtomicWidgets\PropTypes\Flex_Prop_Type; |
| 13 | use Elementor\Modules\AtomicWidgets\PropTypes\Primitives\Number_Prop_Type; |
| 14 | use Elementor\Modules\AtomicWidgets\Styles\Style_Definition; |
| 15 | use Elementor\Modules\AtomicWidgets\Styles\Style_Variant; |
| 16 | use Elementor\Modules\Components\PropTypes\Overridable_Prop_Type; |
| 17 | |
| 18 | if ( ! defined( 'ABSPATH' ) ) { |
| 19 | exit; // Exit if accessed directly. |
| 20 | } |
| 21 | |
| 22 | class Atomic_List_Item_Content extends Atomic_Element_Base { |
| 23 | use Has_Element_Template; |
| 24 | |
| 25 | const BASE_STYLE_KEY = 'base'; |
| 26 | |
| 27 | public static $widget_description = 'A locked content slot for a list item.'; |
| 28 | |
| 29 | public function __construct( $data = [], $args = null ) { |
| 30 | parent::__construct( $data, $args ); |
| 31 | $this->meta( 'permanently_locked', true ); |
| 32 | } |
| 33 | |
| 34 | public static function get_type() { |
| 35 | return 'e-list-item-content'; |
| 36 | } |
| 37 | |
| 38 | public static function get_element_type(): string { |
| 39 | return self::get_type(); |
| 40 | } |
| 41 | |
| 42 | public function get_title() { |
| 43 | return esc_html__( 'List item content', 'elementor' ); |
| 44 | } |
| 45 | |
| 46 | public function get_icon() { |
| 47 | return 'eicon-layout'; |
| 48 | } |
| 49 | |
| 50 | public function should_show_in_panel() { |
| 51 | return false; |
| 52 | } |
| 53 | |
| 54 | public static function get_computed_html_tag( array $settings ): string { |
| 55 | return Html_Tag_Computer::compute( $settings, 'div' ); |
| 56 | } |
| 57 | |
| 58 | protected static function define_props_schema(): array { |
| 59 | return [ |
| 60 | 'classes' => Classes_Prop_Type::make() |
| 61 | ->default( [] ) |
| 62 | ->description( 'CSS classes applied to the content slot container.' ), |
| 63 | 'attributes' => Attributes_Prop_Type::make() |
| 64 | ->meta( Overridable_Prop_Type::ignore() ) |
| 65 | ->description( 'Custom HTML attributes applied to the content slot element.' ), |
| 66 | ]; |
| 67 | } |
| 68 | |
| 69 | protected function define_atomic_controls(): array { |
| 70 | return [ |
| 71 | Section::make() |
| 72 | ->set_label( __( 'Settings', 'elementor' ) ) |
| 73 | ->set_id( 'settings' ) |
| 74 | ->set_items( [] ), |
| 75 | ]; |
| 76 | } |
| 77 | |
| 78 | protected function define_base_styles(): array { |
| 79 | return [ |
| 80 | static::BASE_STYLE_KEY => Style_Definition::make() |
| 81 | ->add_variant( |
| 82 | Style_Variant::make() |
| 83 | ->add_props( [ |
| 84 | 'flex' => Flex_Prop_Type::generate( [ |
| 85 | 'flexGrow' => Number_Prop_Type::generate( 1 ), |
| 86 | ] ), |
| 87 | ] ) |
| 88 | ), |
| 89 | ]; |
| 90 | } |
| 91 | |
| 92 | protected function define_default_children() { |
| 93 | return [ |
| 94 | Atomic_Paragraph::generate() |
| 95 | ->settings( [ |
| 96 | 'paragraph' => Escaped_Html_Prop_Type::generate( __( 'List item', 'elementor' ) ), |
| 97 | ] ) |
| 98 | ->build(), |
| 99 | ]; |
| 100 | } |
| 101 | |
| 102 | protected function get_templates(): array { |
| 103 | return [ |
| 104 | 'elementor/elements/atomic-list-item-content' => __DIR__ . '/atomic-list-item-content.html.twig', |
| 105 | ]; |
| 106 | } |
| 107 | } |
| 108 |