', $content );
$content = is_string( $replacement ) ? $replacement : $content;
}
$content = apply_filters( 'fusion_table_content', fusion_builder_fix_shortcodes( $content ) );
$this->on_render();
return apply_filters( 'fusion_element_table_content', $content, $args );
}
/**
* Load base CSS.
*
* @access public
* @since 3.0
* @return void
*/
public function add_css_files() {
FusionBuilder()->add_element_css( FUSION_BUILDER_PLUGIN_DIR . 'assets/css/shortcodes/table.min.css' );
}
/**
* Builds the attributes array.
*
* @access public
* @since 1.0
* @return array
*/
public function attr() {
if ( $this->args['fusion_table_type'] ) {
$table_style = $this->args['content'][19];
if ( ( '1' === $table_style || '2' === $table_style ) && $table_style !== $this->args['fusion_table_type'] ) {
$this->args['fusion_table_type'] = $table_style;
}
$attr = fusion_builder_visibility_atts(
$this->args['hide_on_mobile'],
[
'class' => 'table-' . $this->args['fusion_table_type'],
]
);
$attr['style'] = $this->get_style_vars();
if ( $this->args['animation_type'] ) {
$attr = Fusion_Builder_Animation_Helper::add_animation_attributes( $this->args, $attr );
}
if ( $this->args['class'] ) {
$attr['class'] .= ' ' . $this->args['class'];
}
if ( $this->args['id'] ) {
$attr['id'] = $this->args['id'];
}
return $attr;
}
return [];
}
/**
* Get the inline style vars.
*
* @since 3.9
* @return string
*/
private function get_style_vars() {
return Fusion_Builder_Margin_Helper::get_margin_vars( $this->args );
}
}
}
new FusionSC_FusionTable();
}
/**
* Map shortcode to Avada Builder.
*/
function fusion_element_table() {
fusion_builder_map(
fusion_builder_frontend_data(
'FusionSC_FusionTable',
[
'name' => __( 'Table', 'fusion-builder' ),
'shortcode' => 'fusion_table',
'icon' => 'fusiona-table',
'allow_generator' => true,
'admin_enqueue_js' => FUSION_BUILDER_PLUGIN_URL . 'shortcodes/js/fusion-table.js',
'help_url' => 'https://avada.com/documentation/table-element/',
'on_settings' => 'calculateTableData',
'params' => [
[
'type' => 'select',
'heading' => esc_attr__( 'Type', 'fusion-builder' ),
'description' => esc_attr__( 'Select the table style.', 'fusion-builder' ),
'param_name' => 'fusion_table_type',
'value' => [
'1' => esc_attr__( 'Style 1', 'fusion-builder' ),
'2' => esc_attr__( 'Style 2', 'fusion-builder' ),
],
'default' => '1',
],
[
'type' => 'range',
'heading' => esc_attr__( 'Number of Rows', 'fusion-builder' ),
'description' => esc_attr__( 'Select how many rows to display.', 'fusion-builder' ),
'param_name' => 'fusion_table_rows',
'value' => '',
'min' => '1',
'max' => '50',
'step' => '1',
'default' => '2',
],
[
'type' => 'range',
'heading' => esc_attr__( 'Number of Columns', 'fusion-builder' ),
'description' => esc_attr__( 'Select how many columns to display.', 'fusion-builder' ),
'param_name' => 'fusion_table_columns',
'value' => '',
'min' => '1',
'max' => '25',
'step' => '1',
'default' => '2',
],
[
'type' => 'tinymce',
'heading' => esc_attr__( 'Table', 'fusion-builder' ),
'description' => esc_attr__( 'Table content will appear here.', 'fusion-builder' ),
'param_name' => 'element_content',
'value' => '
| Column 1 | Column 2 |
|---|
| Column 1 Value | Column 2 Value |
',
],
'fusion_animation_placeholder' => [
'preview_selector' => '.table-1,.table-2',
],
'fusion_margin_placeholder' => [
'param_name' => 'margin',
'group' => esc_attr__( 'General', 'fusion-builder' ),
'value' => [
'margin_top' => '',
'margin_right' => '',
'margin_bottom' => '',
'margin_left' => '',
],
],
[
'type' => 'checkbox_button_set',
'heading' => esc_attr__( 'Element Visibility', 'fusion-builder' ),
'description' => esc_attr__( 'Choose to show or hide the element on small, medium or large screens. You can choose more than one at a time.', 'fusion-builder' ),
'param_name' => 'hide_on_mobile',
'value' => fusion_builder_visibility_options( 'full' ),
'default' => fusion_builder_default_visibility( 'array' ),
],
[
'type' => 'textfield',
'heading' => esc_attr__( 'CSS Class', 'fusion-builder' ),
'description' => esc_attr__( 'Add a class to the wrapping HTML element.', 'fusion-builder' ),
'param_name' => 'class',
'value' => '',
],
[
'type' => 'textfield',
'heading' => esc_attr__( 'CSS ID', 'fusion-builder' ),
'description' => esc_attr__( 'Add an ID to the wrapping HTML element.', 'fusion-builder' ),
'param_name' => 'id',
'value' => '',
],
],
]
)
);
}
add_action( 'fusion_builder_before_init', 'fusion_element_table' );