'https://dondivi.com/grid', 'author' => 'DonDivi', 'author_uri' => 'https://dondivi.com/', ); public function init() { $this->name = esc_html__( 'DonDivi Grid', 'dd_builder' ); $this->child_slug = 'dondivi_grid_item'; $this->icon_path = plugin_dir_path( DDB_PLUGIN_PATH ) . 'builder/icon.svg'; $this->main_css_element = '%%order_class%%'; $this->settings_modal_toggles = array( 'general' => array( 'toggles' => array( 'main_content' => esc_html__( 'Grid', 'et_builder' ), ), ), 'advanced' => array( 'toggles' => array( 'grid' => esc_html__( 'Grid Items', 'dd_builder' ), 'grid_text' => array( 'sub_toggles' => array( 'title' => array( 'name' => et_builder_i18n( 'Title' ), ), 'body' => array( 'name' => et_builder_i18n( 'Body' ), ), ), 'tabbed_subtoggles' => true, 'title' => sprintf( '%1$s %2$s', esc_html__( 'Grid Items', 'dd_builder' ), et_builder_i18n( 'Text' ) ), ), ), ), ); $this->advanced_fields = array( 'borders' => array( 'default' => array(), 'items' => array ( 'css' => array( 'main' => array( 'border_radii' => "{$this->main_css_element} .ddb-grid > div", 'border_styles' => "{$this->main_css_element} .ddb-grid > div", ), ), 'toggle_slug' => 'grid', ), ), 'fonts' => array( 'title' => array( 'label' => et_builder_i18n( 'Title' ), 'css' => array( 'main' => '%%order_class%% .ddb-grid-item-title', 'hover' => '%%order_class%% .dondivi_grid_item:hover .ddb-grid-item-title', ), 'toggle_slug' => 'grid_text', 'sub_toggle' => 'title', ), 'body' => array( 'label' => et_builder_i18n( 'Body' ), 'css' => array( 'main' => '%%order_class%% .ddb-grid-item-body', ), 'font_size' => array( 'default' => absint( et_get_option( 'body_font_size', '14' ) ) . 'px', ), 'line_height' => array( 'default' => floatval( et_get_option( 'body_font_height', '1.7' ) ) . 'em', ), 'toggle_slug' => 'grid_text', 'sub_toggle' => 'body', ), ), 'image_icon' => array( 'image_icon' => array( 'label' => esc_html__( 'Grid Items', 'dd_builder' ), 'css' => array( 'main' => '%%order_class%% .ddb-grid > div', ), 'margin_padding' => array( 'custom_padding' => array( 'default' => '30px|30px|30px|30px|true|true', ), 'use_margin' => false, ), 'toggle_slug' => 'grid', ), ), 'text' => array( 'options' => array( 'text_orientation' => array( 'toggle_slug' => 'grid', ), ), ), 'text_shadow' => array( 'default' => false, ), ); } public function get_fields() { return array( 'grid_columns' => array( 'label' => esc_html__( 'Columns', 'et_builder' ), 'type' => 'range', 'range_settings' => array( 'min' => '1', 'max' => '10', 'step' => '1', ), 'default' => '3', 'unitless' => true, 'mobile_options' => true, 'toggle_slug' => 'main_content' ), 'grid_rows' => array( 'label' => esc_html__( 'Rows', 'et_builder' ), 'type' => 'range', 'default' => '1', 'range_settings' => array( 'min' => '1', 'max' => '10', 'step' => '1', ), 'unitless' => true, 'mobile_options' => true, 'toggle_slug' => 'main_content' ), 'grid_rows_grow' => array( 'label' => esc_html__( 'Rows Growth', 'dd_builder' ), 'type' => 'select', 'options' => array( 'auto' => esc_html__( 'Auto', 'et_builder' ), '1fr' => esc_html__( 'Equal Heights', 'dd_builder' ), ), 'default' => 'auto', 'toggle_slug' => 'main_content' ), 'grid_gap' => array( 'label' => esc_html__( 'Gap', 'et_builder' ), 'type' => 'range', 'default' => '10px', 'default_unit' => 'px', 'mobile_options' => true, 'toggle_slug' => 'main_content' ), 'grid_preview' => array( 'label' => esc_html__( 'Grid Items Preview', 'dd_builder' ), 'type' => 'dondivi_grid_preview', 'toggle_slug' => 'main_content', ), 'items_background_color' => array( 'label' => esc_html__( 'Background Color', 'et_builder' ), 'type' => 'color-alpha', 'custom_color' => true, 'default' => '#F1F5F9', 'mobile_options' => true, 'sticky' => true, 'hover' => 'tabs', 'tab_slug' => 'advanced', 'toggle_slug' => 'grid', ), ); } public function get_transition_fields_css_props() { $fields = parent::get_transition_fields_css_props(); $fields['items_background_color'] = array( 'background-color' => '%%order_class%% .ddb-grid > div', ); return $fields; } public function render( $attrs, $content, $render_slug ) { $this->add_classname( $this->get_text_orientation_classname() ); $this->generate_styles( array( 'base_attr_name' => 'grid_columns', 'selector' => '%%order_class%% .ddb-grid', 'css_property' => '--ddb-grid-columns', 'render_slug' => $render_slug, ) ); $this->generate_styles( array( 'base_attr_name' => 'grid_rows', 'selector' => '%%order_class%% .ddb-grid', 'css_property' => '--ddb-grid-rows', 'render_slug' => $render_slug, ) ); $this->generate_styles( array( 'base_attr_name' => 'grid_rows_grow', 'selector' => '%%order_class%% .ddb-grid', 'css_property' => '--ddb-grid-row-unit', 'render_slug' => $render_slug, ) ); $this->generate_styles( array( 'base_attr_name' => 'grid_gap', 'selector' => '%%order_class%% .ddb-grid', 'css_property' => 'gap', 'render_slug' => $render_slug, ) ); $this->generate_styles( array( 'base_attr_name' => 'items_background_color', 'selector' => '%%order_class%% .ddb-grid > div', 'hover_selector' => '%%order_class%% .ddb-grid > div:hover', 'css_property' => 'background-color', 'render_slug' => $render_slug, ) ); return sprintf( '