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(); } /** * Match each meta icon size (if SVG) with the correspondent font size set by the user. * * Based on the post component similar function. */ function set_meta_font_size_to_svg() { // Required specifically for SVG icons if( \Elementor\Plugin::$instance->experiments->is_feature_active('e_font_icon_svg') == false ){ return; } $size = $this->get_option_size( 'tb-meta_meta_typography_font_size', ['size' => 16, 'unit' => 'px'], true ); // Creates the css variable $metas_css = '--post_meta-font-size: ' . esc_html($size) . ';'; // print it on the main widget wrapper $this->add_render_attribute( '_wrapper', 'style', $metas_css ); } protected function render() { if( !\Elementor\Plugin::$instance->editor->is_edit_mode() ) { $title = wp_title(null,false); $title = $title ? $title : get_bloginfo('name'); }else{ $title = __( 'This is a dummy title.', 'uicore-elements' ); } $this->set_meta_font_size_to_svg(); $meta_list = $this->get_settings_for_display( 'meta_list' ); if(!isset($meta_list[0]) || $meta_list[0]['type'] == ''){ return; } echo '
'; } protected function content_template() { } } \Elementor\Plugin::instance()->widgets_manager->register(new PostMeta());