builder_value ) > 0 ) : $structured_value = []; $columns_array_count = count( $this->columns_array ); for( $i = 0; $i < $columns_array_count; $i++ ) : foreach( $this->builder_value as $container_id => $container_values ) : $id_split = str_split( $container_id ); $row = $id_split[0]; if( $row === (string) $i ) $structured_value[ $i ][] = $container_values; endforeach; endfor; $this->builder_value = $structured_value; endif; // if( ! empty( $this->builder_value ) && is_array( $this->builder_value ) ) $this->builder_value = array_chunk( $this->builder_value, 4 ); } /** * Render the HTML * * @aince 1.0.0 */ protected function render() { if( ! empty( $this->builder_value ) && is_array( $this->builder_value ) ) : $this->opening_div(); foreach( $this->builder_value as $row_index => $row ) : if( $this->check_if_row_has_widgets( $row ) ) continue; // check if there are any widgets in this row $this->render_row( $row, $row_index ); endforeach; $this->get_mobile_canvas(); $this->closing_div(); endif; } /** * Opening div * * @since 1.0.0 */ protected function opening_div() { $wrapperClass = $this->prefix_class . '-normal'; echo '
'; } /** * Closing div * * @since 1.0.0 */ protected function closing_div() { echo '
'; } /** * Get widgets count in row * * @since 1.0.0 */ protected function check_if_row_has_widgets( $row ) { /* merging widgets of all three columns to check if widgets exist of not */ if( count( $row ) > 0 ) : $row_widgets = array_reduce( $row, function( $carry, $item ) { return array_merge( $carry, is_array( $item ) ? $item : [ $item ] ); }, [] ); if( count( $row_widgets ) > 0 ) return false; endif; return true; } /** * Render all the rows * * @since 1.0.0 */ protected function render_row( $row, $index ) { $rowClass = $this->prefix_class . 'row'; $rowClass .= ' row-' . $this->convert_to_string( $index + 1 ); $rowClass .= ' column-' . $this->columns_array[ $index ]; if( $this->responsive === 'desktop' ) : $rowClass .= ' layout-' . $this->column_layouts_array[ $index ]['desktop']; else: $rowClass .= ' tablet-layout-' . $this->column_layouts_array[ $index ]['tablet']; $rowClass .= ' smartphone-layout-' . $this->column_layouts_array[ $index ]['smartphone']; endif; $rowClass .= $this->get_extra_row_classes( $index ); ?>
$column ) : $this->render_column( $column, $column_index, $index ); if( ( $column_index + 1 ) >= $this->columns_array[ $index ] ) break; endforeach; ?>
prefix_class . 'column'; $columnClass .= ' ' . $this->convert_to_string( $index + 1 ); $column_alignments = $this->column_alignments_array[ $row_index ][ $index ]; if( in_array( 'instagram', $column ) ) $columnClass .= ' builder-instagram-widget'; if( $this->responsive === 'desktop' ) : $columnClass .= ' alignment-' . $this->column_alignments_array[ $row_index ][ $index ]['desktop']; else: $columnClass .= ' tablet-alignment--' . $this->column_alignments_array[ $row_index ][ $index ][ 'tablet' ]; $columnClass .= ' smartphone-alignment--' . $this->column_alignments_array[ $row_index ][ $index ][ 'smartphone' ]; endif; $columnClass .= $this->get_extra_column_classes( $row_index, $index ); ?>
$widget ) : $this->render_widget( $widget, $widget_index ); endforeach; ?>
prefix_class . 'widget'; if( $widget === 'you-may-have-missed' ) $widgetClass .= ' builder-ymhm-widget'; if( in_array( $widget, [ 'sidebar-one', 'sidebar-two', 'sidebar-three', 'sidebar-four' ] ) ) $widgetClass .= ' has-sidebar'; ?>
get_widget_html( $widget ); ?>