start_controls_section( 'section_meta', [ 'label' => __( 'Meta Items', 'admore-widgets-suite' ), ] ); $repeater = new Repeater(); $repeater->add_control( 'meta_type', [ 'label' => __( 'Type', 'admore-widgets-suite' ), 'type' => Controls_Manager::SELECT, 'default' => 'date', 'options' => [ 'date' => __( 'Date (Published)', 'admore-widgets-suite' ), 'modified' => __( 'Date (Modified)', 'admore-widgets-suite' ), 'author' => __( 'Author', 'admore-widgets-suite' ), 'categories' => __( 'Categories', 'admore-widgets-suite' ), 'tags' => __( 'Tags', 'admore-widgets-suite' ), 'comments' => __( 'Comments Count', 'admore-widgets-suite' ), 'reading_time' => __( 'Reading Time', 'admore-widgets-suite' ), 'custom' => __( 'Custom Meta Key', 'admore-widgets-suite' ), ], ] ); $repeater->add_control( 'meta_icon', [ 'label' => __( 'Icon', 'admore-widgets-suite' ), 'type' => Controls_Manager::ICONS, 'default' => [ 'value' => 'far fa-calendar', 'library' => 'fa-regular' ], ] ); $repeater->add_control( 'meta_label', [ 'label' => __( 'Label', 'admore-widgets-suite' ), 'type' => Controls_Manager::TEXT, 'placeholder' => __( 'Leave empty for no label', 'admore-widgets-suite' ), ] ); $repeater->add_control( 'date_format', [ 'label' => __( 'Date Format', 'admore-widgets-suite' ), 'type' => Controls_Manager::TEXT, 'default' => 'F j, Y', 'description' => __( 'PHP date format. Default: F j, Y', 'admore-widgets-suite' ), 'condition' => [ 'meta_type' => [ 'date', 'modified' ] ], ] ); $repeater->add_control( 'custom_key', [ 'label' => __( 'Meta Key', 'admore-widgets-suite' ), 'type' => Controls_Manager::TEXT, 'condition' => [ 'meta_type' => 'custom' ], ] ); $this->add_control( 'meta_items', [ 'label' => __( 'Meta Items', 'admore-widgets-suite' ), 'type' => Controls_Manager::REPEATER, 'fields' => $repeater->get_controls(), 'default' => [ [ 'meta_type' => 'date', 'meta_icon' => [ 'value' => 'far fa-calendar', 'library' => 'fa-regular' ] ], [ 'meta_type' => 'author', 'meta_icon' => [ 'value' => 'far fa-user', 'library' => 'fa-regular' ] ], ], 'title_field' => '{{{ meta_type }}}', ] ); $this->add_control( 'layout', [ 'label' => __( 'Layout', 'admore-widgets-suite' ), 'type' => Controls_Manager::SELECT, 'default' => 'inline', 'options' => [ 'inline' => __( 'Inline (horizontal)', 'admore-widgets-suite' ), 'block' => __( 'Stacked (vertical)', 'admore-widgets-suite' ), ], ] ); $this->add_control( 'separator', [ 'label' => __( 'Separator', 'admore-widgets-suite' ), 'type' => Controls_Manager::TEXT, 'default' => '·', 'condition' => [ 'layout' => 'inline' ], ] ); $this->end_controls_section(); $this->start_controls_section( 'style_meta', [ 'label' => __( 'Meta', 'admore-widgets-suite' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'meta_typography', 'selector' => '{{WRAPPER}} .eppro-meta-item', ] ); $this->add_control( 'meta_color', [ 'label' => __( 'Color', 'admore-widgets-suite' ), 'type' => Controls_Manager::COLOR, 'default' => '#64748b', 'selectors' => [ '{{WRAPPER}} .eppro-meta-item' => 'color: {{VALUE}};' ], ] ); $this->add_control( 'meta_link_color', [ 'label' => __( 'Link Color', 'admore-widgets-suite' ), 'type' => Controls_Manager::COLOR, 'default' => '#7c3aed', 'selectors' => [ '{{WRAPPER}} .eppro-meta-item a' => 'color: {{VALUE}};' ], ] ); $this->add_control( 'meta_icon_color', [ 'label' => __( 'Icon Color', 'admore-widgets-suite' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .eppro-meta-icon' => 'color: {{VALUE}};' ], ] ); $this->add_responsive_control( 'meta_gap', [ 'label' => __( 'Gap Between Items', 'admore-widgets-suite' ), 'type' => Controls_Manager::SLIDER, 'default' => [ 'size' => 16, 'unit' => 'px' ], 'selectors' => [ '{{WRAPPER}} .eppro-meta-list' => 'gap: {{SIZE}}{{UNIT}};' ], ] ); $this->end_controls_section(); } protected function render(): void { $s = $this->get_settings_for_display(); $items = $s['meta_items'] ?? []; if ( empty( $items ) ) { if ( \Elementor\Plugin::$instance->editor->is_edit_mode() ) { echo '

' . esc_html__( 'Post Meta', 'admore-widgets-suite' ) . '

' . esc_html__( 'Add meta items in the Content tab.', 'admore-widgets-suite' ) . '

'; } return; } $layout_class = 'block' === $s['layout'] ? 'eppro-meta-list--block' : 'eppro-meta-list--inline'; $sep = esc_html( $s['separator'] ?? '·' ); ?>