Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-conte.../themes/Divi/includes/builder
File: class-et-builder-element.php
'lower-greek' => 'lower-greek',
[4000] Fix | Delete
'lower-latin' => 'lower-latin',
[4001] Fix | Delete
'lower-roman' => 'lower-roman',
[4002] Fix | Delete
'upper-alpha' => 'upper-alpha',
[4003] Fix | Delete
'upper-greek' => 'upper-greek',
[4004] Fix | Delete
'upper-latin' => 'upper-latin',
[4005] Fix | Delete
'upper-roman' => 'upper-roman',
[4006] Fix | Delete
'none' => 'none',
[4007] Fix | Delete
),
[4008] Fix | Delete
'priority' => 80,
[4009] Fix | Delete
'default' => 'decimal',
[4010] Fix | Delete
'default_on_front' => '',
[4011] Fix | Delete
'tab_slug' => 'advanced',
[4012] Fix | Delete
'toggle_slug' => $option_name,
[4013] Fix | Delete
'sub_toggle' => 'ol',
[4014] Fix | Delete
'mobile_options' => true,
[4015] Fix | Delete
);
[4016] Fix | Delete
$additional_options["{$option_name}_ol_position"] = array(
[4017] Fix | Delete
'label' => esc_html__( 'Ordered List Style Position', 'et_builder' ),
[4018] Fix | Delete
'description' => esc_html__( 'The characters that begins each list item can be placed either inside or outside the parent list wrapper. Placing list items inside will indent them further within the list.', 'et_builder' ),
[4019] Fix | Delete
'type' => 'select',
[4020] Fix | Delete
'option_category' => 'configuration',
[4021] Fix | Delete
'options' => array(
[4022] Fix | Delete
'inside' => et_builder_i18n( 'Inside' ),
[4023] Fix | Delete
'outside' => et_builder_i18n( 'Outside' ),
[4024] Fix | Delete
),
[4025] Fix | Delete
'priority' => 85,
[4026] Fix | Delete
'default' => 'inside',
[4027] Fix | Delete
'default_on_front' => '',
[4028] Fix | Delete
'tab_slug' => 'advanced',
[4029] Fix | Delete
'toggle_slug' => $option_name,
[4030] Fix | Delete
'sub_toggle' => 'ol',
[4031] Fix | Delete
'mobile_options' => true,
[4032] Fix | Delete
);
[4033] Fix | Delete
$additional_options["{$option_name}_ol_item_indent"] = array(
[4034] Fix | Delete
'label' => esc_html__( 'Ordered List Item Indent', 'et_builder' ),
[4035] Fix | Delete
'description' => esc_html__( 'Increasing indentation will push list items further towards the center of the text content, giving the list more visible separation from the the rest of the text.', 'et_builder' ),
[4036] Fix | Delete
'type' => 'range',
[4037] Fix | Delete
'option_category' => 'configuration',
[4038] Fix | Delete
'tab_slug' => 'advanced',
[4039] Fix | Delete
'toggle_slug' => $option_name,
[4040] Fix | Delete
'sub_toggle' => 'ol',
[4041] Fix | Delete
'priority' => 90,
[4042] Fix | Delete
'allowed_units' => array( '%', 'em', 'rem', 'px', 'cm', 'mm', 'in', 'pt', 'pc', 'ex', 'vh', 'vw' ),
[4043] Fix | Delete
'default' => '0px',
[4044] Fix | Delete
'default_unit' => 'px',
[4045] Fix | Delete
'default_on_front' => '',
[4046] Fix | Delete
'range_settings' => array(
[4047] Fix | Delete
'min' => '0',
[4048] Fix | Delete
'max' => '100',
[4049] Fix | Delete
'step' => '1',
[4050] Fix | Delete
),
[4051] Fix | Delete
'mobile_options' => true,
[4052] Fix | Delete
);
[4053] Fix | Delete
// c. Quote - Border Weight and Border Color.
[4054] Fix | Delete
$additional_options["{$option_name}_quote_border_weight"] = array(
[4055] Fix | Delete
'label' => esc_html__( 'Blockquote Border Weight', 'et_builder' ),
[4056] Fix | Delete
'description' => esc_html__( 'Block quotes are given a border to separate them from normal text. You can increase or decrease the size of that border using this setting.', 'et_builder' ),
[4057] Fix | Delete
'type' => 'range',
[4058] Fix | Delete
'option_category' => 'configuration',
[4059] Fix | Delete
'tab_slug' => 'advanced',
[4060] Fix | Delete
'toggle_slug' => $option_name,
[4061] Fix | Delete
'sub_toggle' => 'quote',
[4062] Fix | Delete
'priority' => 85,
[4063] Fix | Delete
'allowed_units' => array( 'em', 'rem', 'px', 'cm', 'mm', 'in', 'pt', 'pc', 'ex', 'vh', 'vw' ),
[4064] Fix | Delete
'default' => '5px',
[4065] Fix | Delete
'default_unit' => 'px',
[4066] Fix | Delete
'default_on_front' => '',
[4067] Fix | Delete
'range_settings' => array(
[4068] Fix | Delete
'min' => '0',
[4069] Fix | Delete
'max' => '100',
[4070] Fix | Delete
'step' => '1',
[4071] Fix | Delete
),
[4072] Fix | Delete
'mobile_options' => true,
[4073] Fix | Delete
'hover' => 'tabs',
[4074] Fix | Delete
);
[4075] Fix | Delete
$additional_options["{$option_name}_quote_border_color"] = array(
[4076] Fix | Delete
'label' => esc_html__( 'Blockquote Border Color', 'et_builder' ),
[4077] Fix | Delete
'description' => esc_html__( 'Block quotes are given a border to separate them from normal text. Pick a color to use for that border.', 'et_builder' ),
[4078] Fix | Delete
'type' => 'color-alpha',
[4079] Fix | Delete
'option_category' => 'configuration',
[4080] Fix | Delete
'custom_color' => true,
[4081] Fix | Delete
'tab_slug' => 'advanced',
[4082] Fix | Delete
'toggle_slug' => $option_name,
[4083] Fix | Delete
'sub_toggle' => 'quote',
[4084] Fix | Delete
'field_template' => 'color',
[4085] Fix | Delete
'priority' => 90,
[4086] Fix | Delete
'mobile_options' => true,
[4087] Fix | Delete
'hover' => 'tabs',
[4088] Fix | Delete
);
[4089] Fix | Delete
[4090] Fix | Delete
// Set default on child font settings.
[4091] Fix | Delete
if ( ! empty( $option_settings['fields_default_on_child'] ) ) {
[4092] Fix | Delete
$additional_options["{$option_name}_ul_type"]['default_on_child'] = true;
[4093] Fix | Delete
$additional_options["{$option_name}_ul_position"]['default_on_child'] = true;
[4094] Fix | Delete
$additional_options["{$option_name}_ul_item_indent"]['default_on_child'] = true;
[4095] Fix | Delete
$additional_options["{$option_name}_ol_type"]['default_on_child'] = true;
[4096] Fix | Delete
$additional_options["{$option_name}_ol_position"]['default_on_child'] = true;
[4097] Fix | Delete
$additional_options["{$option_name}_ol_item_indent"]['default_on_child'] = true;
[4098] Fix | Delete
$additional_options["{$option_name}_quote_border_weight"]['default_on_child'] = true;
[4099] Fix | Delete
$additional_options["{$option_name}_quote_border_color"]['default_on_child'] = true;
[4100] Fix | Delete
}
[4101] Fix | Delete
}
[4102] Fix | Delete
}
[4103] Fix | Delete
[4104] Fix | Delete
$this->_additional_fields_options = array_merge( $this->_additional_fields_options, $additional_options );
[4105] Fix | Delete
}
[4106] Fix | Delete
[4107] Fix | Delete
/**
[4108] Fix | Delete
* Add background option fields.
[4109] Fix | Delete
*
[4110] Fix | Delete
* @since 3.23 Add responsive settings for background settings.
[4111] Fix | Delete
*/
[4112] Fix | Delete
protected function _add_background_fields() {
[4113] Fix | Delete
// Background fields are added by default if module has partial or full VB support
[4114] Fix | Delete
if ( $this->has_vb_support() ) {
[4115] Fix | Delete
$this->advanced_fields['background'] = self::$_->array_get( $this->advanced_fields, 'background', array() );
[4116] Fix | Delete
} else if ( ! $this->has_advanced_fields ) {
[4117] Fix | Delete
// Disable if module doesn't set advanced_fields property and has no VB support
[4118] Fix | Delete
return;
[4119] Fix | Delete
}
[4120] Fix | Delete
[4121] Fix | Delete
// Background settings have to be array
[4122] Fix | Delete
if ( ! is_array( self::$_->array_get( $this->advanced_fields, 'background' ) ) ) {
[4123] Fix | Delete
return;
[4124] Fix | Delete
}
[4125] Fix | Delete
[4126] Fix | Delete
$toggle_disabled = self::$_->array_get( $this->advanced_fields, 'background.settings.disable_toggle', false );
[4127] Fix | Delete
$tab_slug = self::$_->array_get( $this->advanced_fields, 'background.settings.tab_slug', 'general' );
[4128] Fix | Delete
$toggle_slug = '';
[4129] Fix | Delete
[4130] Fix | Delete
if ( ! $toggle_disabled ) {
[4131] Fix | Delete
$toggle_slug = self::$_->array_get( $this->advanced_fields, 'background.settings.toggle_slug', 'background' );
[4132] Fix | Delete
[4133] Fix | Delete
$background_toggle = array(
[4134] Fix | Delete
'background' => array(
[4135] Fix | Delete
'title' => et_builder_i18n( 'Background' ),
[4136] Fix | Delete
'priority' => 80,
[4137] Fix | Delete
),
[4138] Fix | Delete
);
[4139] Fix | Delete
[4140] Fix | Delete
$this->_add_settings_modal_toggles( $tab_slug, $background_toggle );
[4141] Fix | Delete
}
[4142] Fix | Delete
[4143] Fix | Delete
$background_field_name = "background";
[4144] Fix | Delete
[4145] Fix | Delete
// Possible values for use_* attributes: true, false, or 'fields_only'
[4146] Fix | Delete
$defaults = array(
[4147] Fix | Delete
'has_background_color_toggle' => false,
[4148] Fix | Delete
'use_background_color' => true,
[4149] Fix | Delete
'use_background_color_gradient' => true,
[4150] Fix | Delete
'use_background_image' => true,
[4151] Fix | Delete
'use_background_video' => true,
[4152] Fix | Delete
'use_background_color_reset' => true,
[4153] Fix | Delete
);
[4154] Fix | Delete
[4155] Fix | Delete
$this->advanced_fields['background'] = wp_parse_args( $this->advanced_fields['background'], $defaults );
[4156] Fix | Delete
[4157] Fix | Delete
$additional_options = array();
[4158] Fix | Delete
[4159] Fix | Delete
if ( $this->advanced_fields['background']['use_background_color'] ) {
[4160] Fix | Delete
$additional_options = array_merge(
[4161] Fix | Delete
$additional_options,
[4162] Fix | Delete
$this->generate_background_options( 'background', 'color', $tab_slug, $toggle_slug, null )
[4163] Fix | Delete
);
[4164] Fix | Delete
}
[4165] Fix | Delete
[4166] Fix | Delete
// Use background color toggle was added on pre color-alpha era. Added for backward
[4167] Fix | Delete
// compatibility. This option's output is printed manually on render()
[4168] Fix | Delete
if ( $this->advanced_fields['background']['has_background_color_toggle'] ) {
[4169] Fix | Delete
$additional_options['use_background_color'] = array(
[4170] Fix | Delete
'label' => esc_html__( 'Use Background Color', 'et_builder' ),
[4171] Fix | Delete
'type' => 'yes_no_button',
[4172] Fix | Delete
'option_category' => 'color_option',
[4173] Fix | Delete
'options' => array(
[4174] Fix | Delete
'on' => et_builder_i18n( 'Yes' ),
[4175] Fix | Delete
'off' => et_builder_i18n( 'No' ),
[4176] Fix | Delete
),
[4177] Fix | Delete
'affects' => array(
[4178] Fix | Delete
'background_color',
[4179] Fix | Delete
),
[4180] Fix | Delete
'tab_slug' => $tab_slug,
[4181] Fix | Delete
'toggle_slug' => $toggle_slug,
[4182] Fix | Delete
'description' => esc_html__( 'Here you can choose whether background color setting above should be used or not.', 'et_builder' ),
[4183] Fix | Delete
'mobile_options' => true,
[4184] Fix | Delete
'hover' => 'tabs',
[4185] Fix | Delete
);
[4186] Fix | Delete
}
[4187] Fix | Delete
[4188] Fix | Delete
if ( $this->advanced_fields['background']['use_background_color_gradient'] ) {
[4189] Fix | Delete
$additional_options = array_merge(
[4190] Fix | Delete
$additional_options,
[4191] Fix | Delete
$this->generate_background_options( 'background', 'gradient', $tab_slug, $toggle_slug, null )
[4192] Fix | Delete
);
[4193] Fix | Delete
}
[4194] Fix | Delete
[4195] Fix | Delete
if ( $this->advanced_fields['background']['use_background_image'] ) {
[4196] Fix | Delete
$additional_options = array_merge(
[4197] Fix | Delete
$additional_options,
[4198] Fix | Delete
$this->generate_background_options( 'background', 'image', $tab_slug, $toggle_slug, null )
[4199] Fix | Delete
);
[4200] Fix | Delete
}
[4201] Fix | Delete
[4202] Fix | Delete
if ( $this->advanced_fields['background']['use_background_video'] ) {
[4203] Fix | Delete
$additional_options = array_merge(
[4204] Fix | Delete
$additional_options,
[4205] Fix | Delete
$this->generate_background_options( 'background', 'video', $tab_slug, $toggle_slug, null )
[4206] Fix | Delete
);
[4207] Fix | Delete
}
[4208] Fix | Delete
[4209] Fix | Delete
// Allow module to configure specific options
[4210] Fix | Delete
[4211] Fix | Delete
$background_options = self::$_->array_get( $this->advanced_fields, 'background.options', false );
[4212] Fix | Delete
[4213] Fix | Delete
if ( $background_options ) {
[4214] Fix | Delete
foreach ( $background_options as $option_slug => $options ) {
[4215] Fix | Delete
if ( ! is_array( $options ) ) {
[4216] Fix | Delete
continue;
[4217] Fix | Delete
}
[4218] Fix | Delete
[4219] Fix | Delete
foreach ( $options as $option_name => $option_value ) {
[4220] Fix | Delete
$additional_options[ $option_slug ][ $option_name ] = $option_value;
[4221] Fix | Delete
}
[4222] Fix | Delete
}
[4223] Fix | Delete
}
[4224] Fix | Delete
[4225] Fix | Delete
$this->_additional_fields_options = array_merge( $this->_additional_fields_options, $additional_options );
[4226] Fix | Delete
}
[4227] Fix | Delete
[4228] Fix | Delete
/**
[4229] Fix | Delete
* Add text option fields.
[4230] Fix | Delete
*
[4231] Fix | Delete
* @since 3.23 Add responsive settings for text orientation and layout settings.
[4232] Fix | Delete
*/
[4233] Fix | Delete
protected function _add_text_fields() {
[4234] Fix | Delete
// Text fields are added by default if module has partial or full VB support
[4235] Fix | Delete
if ( $this->has_vb_support() ) {
[4236] Fix | Delete
$this->advanced_fields['text'] = self::$_->array_get( $this->advanced_fields, 'text', array() );
[4237] Fix | Delete
} else if ( ! $this->has_advanced_fields ) {
[4238] Fix | Delete
// Disable if module doesn't set advanced_fields property and has no VB support
[4239] Fix | Delete
return;
[4240] Fix | Delete
}
[4241] Fix | Delete
[4242] Fix | Delete
// Text settings have to be array
[4243] Fix | Delete
if ( ! is_array( self::$_->array_get( $this->advanced_fields, 'text' ) ) ) {
[4244] Fix | Delete
return;
[4245] Fix | Delete
}
[4246] Fix | Delete
[4247] Fix | Delete
$text_settings = $this->advanced_fields['text'];
[4248] Fix | Delete
$tab_slug = isset( $text_settings['tab_slug'] ) ? $text_settings['tab_slug'] : 'advanced';
[4249] Fix | Delete
$toggle_slug = isset( $text_settings['toggle_slug'] ) ? $text_settings['toggle_slug'] : 'text';
[4250] Fix | Delete
$sub_toggle = isset( $text_settings['sub_toggle'] ) ? $text_settings['sub_toggle'] : '';
[4251] Fix | Delete
$orientation_exclude_options = isset( $text_settings['text_orientation'] ) && isset( $text_settings['text_orientation']['exclude_options'] ) ? $text_settings['text_orientation']['exclude_options'] : array();
[4252] Fix | Delete
[4253] Fix | Delete
// Make sure we can exclude text_orientation from Advanced/Text
[4254] Fix | Delete
$setting_defaults = array(
[4255] Fix | Delete
'use_text_orientation' => true,
[4256] Fix | Delete
'use_background_layout' => false,
[4257] Fix | Delete
);
[4258] Fix | Delete
$text_settings = wp_parse_args( $text_settings, $setting_defaults );
[4259] Fix | Delete
[4260] Fix | Delete
$this->_add_settings_modal_toggles( $tab_slug, array(
[4261] Fix | Delete
$toggle_slug => array(
[4262] Fix | Delete
'title' => et_builder_i18n( 'Text' ),
[4263] Fix | Delete
'priority' => 49,
[4264] Fix | Delete
),
[4265] Fix | Delete
) );
[4266] Fix | Delete
[4267] Fix | Delete
$additional_options = array();
[4268] Fix | Delete
if ( $text_settings['use_text_orientation'] ) {
[4269] Fix | Delete
$default_on_front = self::$_->array_get( $text_settings, 'options.text_orientation.default_on_front', '' );
[4270] Fix | Delete
$additional_options = array(
[4271] Fix | Delete
'text_orientation' => wp_parse_args( self::$_->array_get( $text_settings, 'options.text_orientation', array()), array(
[4272] Fix | Delete
'label' => esc_html__( 'Text Alignment', 'et_builder' ),
[4273] Fix | Delete
'type' => 'text_align',
[4274] Fix | Delete
'option_category' => 'layout',
[4275] Fix | Delete
'options' => et_builder_get_text_orientation_options( $orientation_exclude_options ),
[4276] Fix | Delete
'tab_slug' => $tab_slug,
[4277] Fix | Delete
'toggle_slug' => $toggle_slug,
[4278] Fix | Delete
'description' => esc_html__( 'This controls how your text is aligned within the module.', 'et_builder' ),
[4279] Fix | Delete
'advanced_fields' => true,
[4280] Fix | Delete
'default' => self::$_->array_get( $text_settings, 'options.text_orientation.default', $default_on_front ),
[4281] Fix | Delete
'mobile_options' => true,
[4282] Fix | Delete
) ),
[4283] Fix | Delete
);
[4284] Fix | Delete
[4285] Fix | Delete
if ( '' !== $sub_toggle ) {
[4286] Fix | Delete
$additional_options['text_orientation']['sub_toggle'] = $sub_toggle;
[4287] Fix | Delete
}
[4288] Fix | Delete
}
[4289] Fix | Delete
[4290] Fix | Delete
// Background layout works by setting text to light/dark color. This was added before text
[4291] Fix | Delete
// color has its own colorpicker as a simple mechanism for picking color.
[4292] Fix | Delete
// New module should not use this option. This is kept for backward compatibility
[4293] Fix | Delete
if ( $text_settings['use_background_layout'] ) {
[4294] Fix | Delete
$additional_options['background_layout'] = array(
[4295] Fix | Delete
'label' => esc_html__( 'Text Color', 'et_builder' ),
[4296] Fix | Delete
'type' => 'select',
[4297] Fix | Delete
'option_category' => 'color_option',
[4298] Fix | Delete
'options' => array(
[4299] Fix | Delete
'dark' => et_builder_i18n( 'Light' ),
[4300] Fix | Delete
'light' => et_builder_i18n( 'Dark' ),
[4301] Fix | Delete
),
[4302] Fix | Delete
'tab_slug' => $tab_slug,
[4303] Fix | Delete
'toggle_slug' => $toggle_slug,
[4304] Fix | Delete
'hover' => 'tabs',
[4305] Fix | Delete
'description' => esc_html__( 'Here you can choose whether your text should be light or dark. If you are working with a dark background, then your text should be light. If your background is light, then your text should be set to dark.', 'et_builder' ),
[4306] Fix | Delete
'mobile_options' => true,
[4307] Fix | Delete
);
[4308] Fix | Delete
[4309] Fix | Delete
if ( '' !== $sub_toggle ) {
[4310] Fix | Delete
$additional_options['background_layout']['sub_toggle'] = $sub_toggle;
[4311] Fix | Delete
}
[4312] Fix | Delete
}
[4313] Fix | Delete
[4314] Fix | Delete
// Allow module to configure specific options
[4315] Fix | Delete
if ( isset( $text_settings['options'] ) && is_array( $text_settings['options'] ) ) {
[4316] Fix | Delete
foreach ( $text_settings['options'] as $option_slug => $options ) {
[4317] Fix | Delete
if ( ! is_array( $options ) ) {
[4318] Fix | Delete
continue;
[4319] Fix | Delete
}
[4320] Fix | Delete
[4321] Fix | Delete
foreach ( $options as $option_name => $option_value ) {
[4322] Fix | Delete
if ( isset( $additional_options[ $option_slug ] ) ) {
[4323] Fix | Delete
$additional_options[ $option_slug ][ $option_name ] = $option_value;
[4324] Fix | Delete
}
[4325] Fix | Delete
}
[4326] Fix | Delete
}
[4327] Fix | Delete
}
[4328] Fix | Delete
[4329] Fix | Delete
$this->_additional_fields_options = array_merge( $this->_additional_fields_options, $additional_options );
[4330] Fix | Delete
}
[4331] Fix | Delete
[4332] Fix | Delete
/**
[4333] Fix | Delete
* Add Border & Border Radius fields to each module. Default borders option are added on with
[4334] Fix | Delete
* Borders fields group on Design tab. However, module can add more borders field by adding
[4335] Fix | Delete
* more settings on $this->advanced_fields['borders']
[4336] Fix | Delete
*
[4337] Fix | Delete
* @since 3.1
[4338] Fix | Delete
*
[4339] Fix | Delete
* {@internal
[4340] Fix | Delete
* border options are initially defined via _add_additional_border_fields() method and adding
[4341] Fix | Delete
* more border options require overwriting it on module's class. This is repetitive so
[4342] Fix | Delete
* the fields registration mechanics were simplified mimicing advanced fonts field mechanism.}
[4343] Fix | Delete
*/
[4344] Fix | Delete
protected function _add_borders_fields() {
[4345] Fix | Delete
// Disable if module doesn't set advanced_fields property and has no VB support
[4346] Fix | Delete
if ( ! $this->has_vb_support() && ! $this->has_advanced_fields ) {
[4347] Fix | Delete
return;
[4348] Fix | Delete
}
[4349] Fix | Delete
[4350] Fix | Delete
// Get borders settings. Fallback to default if needed. Borders are added to all modules by default
[4351] Fix | Delete
// unless the module explicitly disabled it
[4352] Fix | Delete
// Backward compatibility. Use `border` settings as default if exist
[4353] Fix | Delete
$legacy_border = self::$_->array_get( $this->advanced_fields, 'border', array() );
[4354] Fix | Delete
[4355] Fix | Delete
$borders_fields = self::$_->array_get( $this->advanced_fields, 'borders', array(
[4356] Fix | Delete
'default' => $legacy_border,
[4357] Fix | Delete
) );
[4358] Fix | Delete
[4359] Fix | Delete
// Borders settings have to be array
[4360] Fix | Delete
if ( ! is_array( $borders_fields ) ) {
[4361] Fix | Delete
return;
[4362] Fix | Delete
}
[4363] Fix | Delete
[4364] Fix | Delete
$i18n =& self::$i18n;
[4365] Fix | Delete
[4366] Fix | Delete
if ( ! isset( $i18n['border'] ) ) {
[4367] Fix | Delete
// phpcs:disable WordPress.WP.I18n.MissingTranslatorsComment
[4368] Fix | Delete
$i18n['border'] = array(
[4369] Fix | Delete
'title' => esc_html__( 'Border', 'et_builder' ),
[4370] Fix | Delete
);
[4371] Fix | Delete
// phpcs:enable
[4372] Fix | Delete
}
[4373] Fix | Delete
[4374] Fix | Delete
// Loop border settings, enable multiple border fields declaration in one place
[4375] Fix | Delete
foreach ( $borders_fields as $border_fields_name => $border_fields ) {
[4376] Fix | Delete
[4377] Fix | Delete
// Enable module to disable border options by setting it to false
[4378] Fix | Delete
if ( false === $border_fields ) {
[4379] Fix | Delete
continue;
[4380] Fix | Delete
}
[4381] Fix | Delete
[4382] Fix | Delete
// Make sure that border fields has minimum attribute required
[4383] Fix | Delete
$border_fields_defaults = array(
[4384] Fix | Delete
'tab_slug' => 'advanced',
[4385] Fix | Delete
'toggle_slug' => 'border',
[4386] Fix | Delete
);
[4387] Fix | Delete
[4388] Fix | Delete
$border_fields = wp_parse_args( $border_fields, $border_fields_defaults );
[4389] Fix | Delete
[4390] Fix | Delete
// Check for default border options
[4391] Fix | Delete
$is_default_border_options = 'default' === $border_fields_name;
[4392] Fix | Delete
[4393] Fix | Delete
if ( $is_default_border_options ) {
[4394] Fix | Delete
// Default border fields doesn't have toggle for itself, thus register new toggle
[4395] Fix | Delete
$this->_add_settings_modal_toggles( $border_fields['tab_slug'], array(
[4396] Fix | Delete
$border_fields['toggle_slug'] => array(
[4397] Fix | Delete
'title' => $i18n['border']['title'],
[4398] Fix | Delete
'priority' => 95,
[4399] Fix | Delete
),
[4400] Fix | Delete
) );
[4401] Fix | Delete
}
[4402] Fix | Delete
[4403] Fix | Delete
// Add suffix to border fields settings
[4404] Fix | Delete
$suffix = $is_default_border_options ? '' : "_{$border_fields_name}";
[4405] Fix | Delete
$border_fields['suffix'] = $suffix;
[4406] Fix | Delete
[4407] Fix | Delete
// Assign CSS setting to advanced options
[4408] Fix | Delete
if ( isset( $border_fields['css'] ) ) {
[4409] Fix | Delete
$this->advanced_fields["border{$suffix}"]['css'] = $border_fields['css'];
[4410] Fix | Delete
}
[4411] Fix | Delete
[4412] Fix | Delete
// Add border fields to advanced_fields. Each border fields (style + radii) has its own attribute
[4413] Fix | Delete
// registered on $this->advanced_fields
[4414] Fix | Delete
self::$_->array_set( $this->advanced_fields, "border{$suffix}", $border_fields );
[4415] Fix | Delete
[4416] Fix | Delete
$this->_additional_fields_options = array_merge(
[4417] Fix | Delete
$this->_additional_fields_options,
[4418] Fix | Delete
ET_Builder_Module_Fields_Factory::get( 'Border' )->get_fields( $border_fields )
[4419] Fix | Delete
);
[4420] Fix | Delete
[4421] Fix | Delete
// Add module defined fields that needs to be added after existing border options
[4422] Fix | Delete
if ( isset( $border_fields['fields_after'] ) ) {
[4423] Fix | Delete
$this->_additional_fields_options = array_merge(
[4424] Fix | Delete
$this->_additional_fields_options,
[4425] Fix | Delete
$border_fields['fields_after']
[4426] Fix | Delete
);
[4427] Fix | Delete
}
[4428] Fix | Delete
[4429] Fix | Delete
// Loop radii and styles and add fields to advanced_fields
[4430] Fix | Delete
foreach ( array( 'border_radii', 'border_styles' ) as $border_key ) {
[4431] Fix | Delete
$border_key_name = $border_key . $suffix;
[4432] Fix | Delete
[4433] Fix | Delete
if ( isset( $this->advanced_fields["border{$suffix}"][ $border_key_name ] ) ) {
[4434] Fix | Delete
// Backward compatibility. Properly handle existing 3rd party module that
[4435] Fix | Delete
// directly defines border via direct $this->advanced_fields["border{$suffix}"]
[4436] Fix | Delete
$this->advanced_fields["border{$suffix}"][ $border_key_name ] = array_merge(
[4437] Fix | Delete
$this->advanced_fields["border{$suffix}"][ $border_key_name ],
[4438] Fix | Delete
$this->_additional_fields_options[ $border_key_name ]
[4439] Fix | Delete
);
[4440] Fix | Delete
[4441] Fix | Delete
$message = "You're Doing It Wrong! You shouldn't define border settings in 'advanced_fields' directly. All the Border settings should be defined via provided API";
[4442] Fix | Delete
et_debug( $message );
[4443] Fix | Delete
} else {
[4444] Fix | Delete
// Border used to rely on $this->advanced_fields complete configuration for
[4445] Fix | Delete
// rendering. Since option template update, border style rendering fetches
[4446] Fix | Delete
// border setting based on rebuilt fields on demand for performance reason.
[4447] Fix | Delete
}
[4448] Fix | Delete
}
[4449] Fix | Delete
}
[4450] Fix | Delete
[4451] Fix | Delete
if ( method_exists( $this, '_add_additional_border_fields' ) ) {
[4452] Fix | Delete
// Backwards compatibility should go after all the fields added to emulate behavior of old version
[4453] Fix | Delete
$this->_add_additional_border_fields();
[4454] Fix | Delete
[4455] Fix | Delete
$message = "You're Doing It Wrong! '_add_additional_border_fields' is deprecated. All the Border settings should be defined via provided API";
[4456] Fix | Delete
et_debug( $message );
[4457] Fix | Delete
}
[4458] Fix | Delete
}
[4459] Fix | Delete
[4460] Fix | Delete
protected function _add_transforms_fields() {
[4461] Fix | Delete
$i18n =& self::$i18n;
[4462] Fix | Delete
[4463] Fix | Delete
if ( ! isset( $i18n['transforms'] ) ) {
[4464] Fix | Delete
// phpcs:disable WordPress.WP.I18n.MissingTranslatorsComment
[4465] Fix | Delete
$i18n['transforms'] = array(
[4466] Fix | Delete
'title' => esc_html__( 'Transform', 'et_builder' ),
[4467] Fix | Delete
);
[4468] Fix | Delete
// phpcs:enable
[4469] Fix | Delete
}
[4470] Fix | Delete
[4471] Fix | Delete
$this->advanced_fields['transform'] = self::$_->array_get( $this->advanced_fields, 'transform', array() );
[4472] Fix | Delete
[4473] Fix | Delete
// Transforms Disabled
[4474] Fix | Delete
if ( false === $this->advanced_fields['transform'] ) {
[4475] Fix | Delete
return;
[4476] Fix | Delete
}
[4477] Fix | Delete
[4478] Fix | Delete
// Transforms settings have to be array
[4479] Fix | Delete
if ( ! is_array( $this->advanced_fields['transform'] ) ) {
[4480] Fix | Delete
return;
[4481] Fix | Delete
}
[4482] Fix | Delete
[4483] Fix | Delete
$this->settings_modal_toggles['advanced']['toggles']['transform'] = array(
[4484] Fix | Delete
'title' => $i18n['transforms']['title'],
[4485] Fix | Delete
'priority' => 109,
[4486] Fix | Delete
);
[4487] Fix | Delete
[4488] Fix | Delete
$this->_additional_fields_options = array_merge(
[4489] Fix | Delete
$this->_additional_fields_options,
[4490] Fix | Delete
/** @see ET_Builder_Module_Field_Transform::get_fields() */
[4491] Fix | Delete
ET_Builder_Module_Fields_Factory::get( 'Transform' )->get_fields()
[4492] Fix | Delete
);
[4493] Fix | Delete
[4494] Fix | Delete
}
[4495] Fix | Delete
[4496] Fix | Delete
protected function _add_sizing_fields() {
[4497] Fix | Delete
// Maybe someone did overwrite this function
[4498] Fix | Delete
$this->_add_max_width_fields();
[4499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function