/** * Shortcode row * * @since 1.0.0 * @access public * @param array $atts * @param string $content * @return string */ public static function row($atts, $content = null) { global $pagenow; // Use wp_parse_args instead of shortcode_atts because we use custom filter. $atts = apply_filters('tf_shortcode_atts', wp_parse_args($atts, array('class' => '', 'gutter' => 'tf_gutter_default', 'grid' => '1-col', 'overlay_color' => '', 'row_anchor' => '', 'row_height' => 'tf_row_height_default', 'row_width' => 'tf_row_width_default', 'editable_markup' => 'false'))); $before = ''; $after = ''; /* additional html attributes to add to the row wrapper */ $html_atts = ''; $classes = array_merge(array('tf_row', $atts['gutter'], $atts['row_height'], $atts['row_width'], 'tf_row_block_' . $atts['sc_id']), explode(' ', $atts['class'])); if (!is_admin()) { $classes[] = 'grid_' . $atts['grid']; } $row_attrs = apply_filters('tf_row_attrs', array('class' => $classes), $atts); $row_attrs['class'] = implode(' ', apply_filters('tf_row_classes', $row_attrs['class'])); foreach ($row_attrs as $key => $value) { $html_atts .= sprintf(" %s='%s'", $key, esc_attr($value)); // using single quotes in case we need to store json objects in attributes } if (isset($atts['editable_markup']) && 'true' == $atts['editable_markup']) { $style_link = sprintf('<div class="tf_styling_menu tf_row_top_item"><a href="#" title="%s" class="tf_styling_row tf-tooltips"><span class="ti-brush"></span></a></div>', __('Styling', 'themify-flow')); if ('backend' == TF_Model::get_current_builder_mode()) { $style_link = ''; } $before = sprintf(' <div class="tf_row_top tf_interface"> <div class="tf_row_top_toolbar"> <div class="tf_row_menu"> <div class="menu_icon"></div> <ul class="tf_dropdown"> <li><a href="#" class="tf_option_row"><span class="ti-pencil"></span> %s</a></li> <li><a href="#" class="tf_duplicate_row"><span class="ti-layers"></span> %s</a></li> <li><a href="#" class="tf_delete_row"><span class="ti-close"></span> %s</a></li> </ul> </div> %s %s </div> <div class="toggle_row"></div> </div> <div class="tf_row_wrapper"><div class="tf_row_inner">', __('Options', 'themify-flow'), __('Duplicate', 'themify-flow'), __('Delete', 'themify-flow'), tf_grid_lists('row', $atts['gutter']), $style_link); $before .= '<div class="tf_row_content">'; $after = '</div></div></div>'; $print_atts = $atts; unset($print_atts['editable_markup']); $output = sprintf('<div data-tf-shortcode="%s" data-tf-atts="%s"%s>', 'tf_row', esc_attr(json_encode(tf_escape_atts($print_atts))), $html_atts); } else { $before = '<div class="tf_row_wrapper"><div class="tf_row_inner">'; $after = '</div><!-- /tf_row_inner --></div><!-- /tf_row_wrapper -->'; $output = sprintf('<div %s>', $html_atts); } $output .= apply_filters('tf_row_before', $before, $atts); $output .= do_shortcode($content); $output .= apply_filters('tf_row_after', $after, $atts); $output .= '</div><!-- /tf_row -->'; return apply_filters('tf_shortcode_row', $output, $atts); }