experiments->is_feature_active('e_optimized_markup'); } protected function register_controls() { $this->start_controls_section( 'section_content', [ 'label' => esc_html__('Content', 'uicore-elements'), ] ); $this->add_control( 'meta_list', [ 'label' => esc_html__('Meta Data', 'uicore-elements'), 'type' => \Elementor\Controls_Manager::REPEATER, 'fields' => $this->get_meta_content_controls(), 'default' => [ [ 'type' => 'author' ], ], 'title_field' => '{{{ type }}}', 'prevent_empty' => false, 'separator' => 'before' ] ); $this->add_responsive_control( 'content_align', [ 'label' => esc_html__('Content Alignment', 'uicore-elements'), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => esc_html__('Left', 'uicore-elements'), 'icon' => 'eicon-text-align-left', ], 'center' => [ 'title' => esc_html__('Center', 'uicore-elements'), 'icon' => 'eicon-text-align-center', ], ], 'selectors' => [ '{{WRAPPER}}' => 'text-align: {{VALUE}};', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_meta_style', [ 'label' => esc_html__('Style', 'uicore-elements'), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->get_meta_style_controls(); $this->end_controls_section(); } protected function display_dummy_text($meta_list) { echo '
'; foreach ($meta_list as $meta) { if ($meta['type'] != 'none') { $dummy_content = [ 'excerpt' => esc_html__('This is a sample post excerpt. It provides a brief summary of the article, giving readers a quick preview of the content before they click through to read the full post.', 'uicore-elements'), 'comment' => rand(1, 5), 'reading time' => rand(1, 5) ]; // Print dummy content, if available if (array_key_exists($meta['type'], $dummy_content)) { $content = $dummy_content[$meta['type']]; // The content printing is the same from display_meta() and should follow up future changes $wrapper = '
'; $prefix = $meta['before'] ? '' . esc_html($meta['before']) . '' : ''; $suffix = $meta['after'] ? '' . esc_html($meta['after']) . '' : ''; ob_start(); \Elementor\Icons_Manager::render_icon($meta['icon'], ['aria-hidden' => 'true', 'class' => 'ui-e-meta-icon'], 'span'); $icon = ob_get_clean(); if (!empty($content)) { echo $wrapper . Helper::esc_svg($icon) . $prefix . $content . $suffix . '
'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } } else { $this->display_meta($meta); } if (next($meta_list) && $this->get_settings_for_display('tb-meta_meta_separator')) { echo '' . esc_html($this->get_settings_for_display('tb-meta_meta_separator')) . ''; } } } echo '
'; } protected function render() { $meta_list = $this->get_settings_for_display('meta_list'); if (!isset($meta_list[0]) || $meta_list[0]['type'] == '') { return; } if ($this->is_edit_mode()) { $this->display_dummy_text($meta_list); return; } echo '
'; foreach ($meta_list as $meta) { if ($meta['type'] != 'none') { $this->display_meta($meta); if (next($meta_list) && $this->get_settings_for_display('tb-meta_meta_separator')) { echo '' . esc_html($this->get_settings_for_display('tb-meta_meta_separator')) . ''; } } } echo '
'; } protected function content_template() {} } \Elementor\Plugin::instance()->widgets_manager->register(new PostMeta());