attribute['sg_setting_title_tag'] ); $behavior = esc_attr( $this->attribute['sg_setting_behavior'] ); $image_size = esc_attr( $this->attribute['sg_gallery_image_size_imagesize_size'] ); $more_enable = 'yes' === $this->attribute['sg_setting_more_enable']; foreach ( $this->attribute['sg_gallery_list'] as $key => $item ) { $row = $row . $this->render_row_item( $key, $item, $html_tag, $more_enable ); $gallery = $gallery . $this->render_gallery_item( $key, $item, $image_size ); } $output = ''; return $this->render_wrapper( 'portfolio-gallery', $output, array( 'on-' . $behavior ) ); } /** * Render row item * * @param string $key Key. * @param array $item Image option. * @param string $html_tag HTML Tag option. * @param bool $more_enable More option enable. * * @return mixed */ public function render_row_item( $key, $item, $html_tag, $more_enable ) { $info = null; $more = null; $output = null; $id = 'elementor-repeater-item-' . esc_attr( $item['_id'] ); $title = esc_attr( $item['sg_gallery_list_title'] ); $subtitle = esc_attr( $item['sg_gallery_list_subtitle'] ); $current_item = 0 === $key || 'yes' === $item['sg_gallery_list_current'] ? 'current-item' : ''; $info = '

' . $subtitle . '

<' . $html_tag . ' class="info-title">' . $title . '
'; if ( $more_enable ) { $more_text = esc_attr( $item['sg_gallery_list_more_text'] ); $more_icon = $this->render_icon_element( $item['sg_gallery_list_more_icon'] ); if ( 'before' === $item['sg_gallery_list_more_icon_position'] ) { $more = '
' . $this->render_url_element( $item['sg_gallery_list_more_link'], null, null, $more_icon . $more_text ) . '
'; } else { $more = '
' . $this->render_url_element( $item['sg_gallery_list_more_link'], null, null, $more_text . $more_icon ) . '
'; } } $output = '
' . $info . $more . '
'; return $output; } /** * Render gallery item. * * @param string $key Key. * @param array $item Image option. * @param string $image_size Image size option. * * @return mixed */ public function render_gallery_item( $key, $item, $image_size ) { $current_item = 0 === $key || 'yes' === $item['sg_gallery_list_current'] ? 'current-item' : ''; $image_attachment = ! empty( $item['sg_gallery_list_image']['id'] ) ? wp_get_attachment_image_src( $item['sg_gallery_list_image']['id'], $image_size ) : ''; $image_src = ! empty( $image_attachment[0] ) ? $image_attachment[0] : $item['sg_gallery_list_image']['url']; $output = ''; return $output; } }