Edit File by line
/home/barbar84/www/wp-conte.../themes/Divi/includes/builder/module/field
File: Height.php
<?php
[0] Fix | Delete
[1] Fix | Delete
class ET_Builder_Module_Field_Height extends ET_Builder_Module_Field_Base {
[2] Fix | Delete
[3] Fix | Delete
/**
[4] Fix | Delete
* Translations.
[5] Fix | Delete
*
[6] Fix | Delete
* @var array
[7] Fix | Delete
*/
[8] Fix | Delete
protected $i18n = array();
[9] Fix | Delete
[10] Fix | Delete
public function get_defaults() {
[11] Fix | Delete
return array(
[12] Fix | Delete
'prefix' => '',
[13] Fix | Delete
'use_min_height' => true,
[14] Fix | Delete
'use_height' => true,
[15] Fix | Delete
'use_max_height' => true,
[16] Fix | Delete
);
[17] Fix | Delete
}
[18] Fix | Delete
[19] Fix | Delete
public function get_fields( array $args = array() ) {
[20] Fix | Delete
$settings = array_merge( $this->get_defaults(), $args );
[21] Fix | Delete
[22] Fix | Delete
return array_merge(
[23] Fix | Delete
$this->get_min_height( $settings ),
[24] Fix | Delete
$this->get_height( $settings ),
[25] Fix | Delete
$this->get_max_height( $settings )
[26] Fix | Delete
);
[27] Fix | Delete
}
[28] Fix | Delete
[29] Fix | Delete
private function get_min_height( $settings ) {
[30] Fix | Delete
if ( ! $settings['use_min_height'] ) {
[31] Fix | Delete
return array();
[32] Fix | Delete
}
[33] Fix | Delete
[34] Fix | Delete
$helper = et_pb_min_height_options( $settings['prefix'] );
[35] Fix | Delete
[36] Fix | Delete
$i18n =& $this->i18n;
[37] Fix | Delete
[38] Fix | Delete
if ( ! isset( $i18n['minheight'] ) ) {
[39] Fix | Delete
// phpcs:disable WordPress.WP.I18n.MissingTranslatorsComment
[40] Fix | Delete
$i18n['minheight'] = array(
[41] Fix | Delete
'label' => __( 'Min Height', 'et_builder' ),
[42] Fix | Delete
'description' => __( 'When a minimum height is set, the element will always have a height of at least the amount defined. This supersedes smaller static height values. Unlike height, minimum height does not result in content overflow and will allow the height of your element to remain dynamic.', 'et_builder' ),
[43] Fix | Delete
);
[44] Fix | Delete
// phpcs:enable
[45] Fix | Delete
}
[46] Fix | Delete
[47] Fix | Delete
return array_merge(
[48] Fix | Delete
array(
[49] Fix | Delete
$helper->get_field() => array_merge(
[50] Fix | Delete
array(
[51] Fix | Delete
'label' => $i18n['minheight']['label'],
[52] Fix | Delete
'description' => $i18n['minheight']['description'],
[53] Fix | Delete
'default' => 'auto',
[54] Fix | Delete
'default_tablet' => 'auto',
[55] Fix | Delete
'default_phone' => 'auto',
[56] Fix | Delete
'allowed_values' => et_builder_get_acceptable_css_string_values( 'min-height' ),
[57] Fix | Delete
'range_settings' => array(
[58] Fix | Delete
'min' => 100,
[59] Fix | Delete
'max' => 1000,
[60] Fix | Delete
'step' => 1,
[61] Fix | Delete
),
[62] Fix | Delete
),
[63] Fix | Delete
$this->get_base_field()
[64] Fix | Delete
),
[65] Fix | Delete
),
[66] Fix | Delete
$this->responsive_fields( $helper->get_field() )
[67] Fix | Delete
);
[68] Fix | Delete
}
[69] Fix | Delete
[70] Fix | Delete
private function get_height( $settings ) {
[71] Fix | Delete
if ( ! $settings['use_height'] ) {
[72] Fix | Delete
return array();
[73] Fix | Delete
}
[74] Fix | Delete
[75] Fix | Delete
$helper = et_pb_height_options( $settings['prefix'] );
[76] Fix | Delete
[77] Fix | Delete
$i18n =& $this->i18n;
[78] Fix | Delete
[79] Fix | Delete
if ( ! isset( $i18n['height'] ) ) {
[80] Fix | Delete
// phpcs:disable WordPress.WP.I18n.MissingTranslatorsComment
[81] Fix | Delete
$i18n['height'] = array(
[82] Fix | Delete
'label' => __( 'Height', 'et_builder' ),
[83] Fix | Delete
'description' => __( 'This sets a static height value for your element. Once set, the height of the element will no longer be determined by its inner content. Content that exceeds the static height of the element will overflow the element wrapper.', 'et_builder' ),
[84] Fix | Delete
);
[85] Fix | Delete
// phpcs:enable
[86] Fix | Delete
}
[87] Fix | Delete
[88] Fix | Delete
return array_merge(
[89] Fix | Delete
array(
[90] Fix | Delete
$helper->get_field() => array_merge(
[91] Fix | Delete
array(
[92] Fix | Delete
'label' => $i18n['height']['label'],
[93] Fix | Delete
'description' => $i18n['height']['description'],
[94] Fix | Delete
'default' => 'auto',
[95] Fix | Delete
'default_tablet' => 'auto',
[96] Fix | Delete
'default_phone' => 'auto',
[97] Fix | Delete
'allowed_values' => et_builder_get_acceptable_css_string_values( 'height' ),
[98] Fix | Delete
'range_settings' => array(
[99] Fix | Delete
'min' => 100,
[100] Fix | Delete
'max' => 1000,
[101] Fix | Delete
'step' => 1,
[102] Fix | Delete
),
[103] Fix | Delete
),
[104] Fix | Delete
$this->get_base_field()
[105] Fix | Delete
),
[106] Fix | Delete
),
[107] Fix | Delete
$this->responsive_fields( $helper->get_field() )
[108] Fix | Delete
);
[109] Fix | Delete
}
[110] Fix | Delete
[111] Fix | Delete
private function get_max_height( $settings ) {
[112] Fix | Delete
if ( ! $settings['use_max_height'] ) {
[113] Fix | Delete
return array();
[114] Fix | Delete
}
[115] Fix | Delete
[116] Fix | Delete
$helper = et_pb_max_height_options( $settings['prefix'] );
[117] Fix | Delete
[118] Fix | Delete
$i18n =& $this->i18n;
[119] Fix | Delete
[120] Fix | Delete
if ( ! isset( $i18n['maxheight'] ) ) {
[121] Fix | Delete
// phpcs:disable WordPress.WP.I18n.MissingTranslatorsComment
[122] Fix | Delete
$i18n['maxheight'] = array(
[123] Fix | Delete
'label' => __( 'Max Height', 'et_builder' ),
[124] Fix | Delete
'description' => __( 'Setting a maximum height will prevent your element from ever surpassing the defined height value. As your module content increases and surpasses the maximum height, it will overflow the element wrapper.', 'et_builder' ),
[125] Fix | Delete
);
[126] Fix | Delete
// phpcs:enable
[127] Fix | Delete
}
[128] Fix | Delete
[129] Fix | Delete
return array_merge(
[130] Fix | Delete
array(
[131] Fix | Delete
$helper->get_field() => array_merge(
[132] Fix | Delete
array(
[133] Fix | Delete
'label' => $i18n['maxheight']['label'],
[134] Fix | Delete
'description' => $i18n['maxheight']['description'],
[135] Fix | Delete
'default' => 'none',
[136] Fix | Delete
'default_tablet' => 'none',
[137] Fix | Delete
'default_phone' => 'none',
[138] Fix | Delete
'allowed_values' => et_builder_get_acceptable_css_string_values( 'max-height' ),
[139] Fix | Delete
'range_settings' => array(
[140] Fix | Delete
'min' => 100,
[141] Fix | Delete
'max' => 1000,
[142] Fix | Delete
'step' => 1,
[143] Fix | Delete
),
[144] Fix | Delete
),
[145] Fix | Delete
$this->get_base_field()
[146] Fix | Delete
),
[147] Fix | Delete
),
[148] Fix | Delete
$this->responsive_fields( $helper->get_field() )
[149] Fix | Delete
);
[150] Fix | Delete
}
[151] Fix | Delete
[152] Fix | Delete
private function get_base_field() {
[153] Fix | Delete
return array(
[154] Fix | Delete
'type' => 'range',
[155] Fix | Delete
'hover' => 'tabs',
[156] Fix | Delete
'default_on_child' => true,
[157] Fix | Delete
'mobile_options' => true,
[158] Fix | Delete
'sticky' => true,
[159] Fix | Delete
'validate_unit' => true,
[160] Fix | Delete
'unitless' => false,
[161] Fix | Delete
'default_unit' => 'px',
[162] Fix | Delete
'allow_empty' => true,
[163] Fix | Delete
'tab_slug' => 'advanced',
[164] Fix | Delete
'toggle_slug' => 'width',
[165] Fix | Delete
);
[166] Fix | Delete
}
[167] Fix | Delete
[168] Fix | Delete
private function responsive_fields( $field ) {
[169] Fix | Delete
return array(
[170] Fix | Delete
"{$field}_tablet" => array(
[171] Fix | Delete
'type' => 'skip',
[172] Fix | Delete
'tab_slug' => 'advanced',
[173] Fix | Delete
'toggle_slug' => 'width',
[174] Fix | Delete
),
[175] Fix | Delete
"{$field}_phone" => array(
[176] Fix | Delete
'type' => 'skip',
[177] Fix | Delete
'tab_slug' => 'advanced',
[178] Fix | Delete
'toggle_slug' => 'width',
[179] Fix | Delete
),
[180] Fix | Delete
"{$field}_last_edited" => array(
[181] Fix | Delete
'type' => 'skip',
[182] Fix | Delete
'tab_slug' => 'advanced',
[183] Fix | Delete
'toggle_slug' => 'width',
[184] Fix | Delete
),
[185] Fix | Delete
);
[186] Fix | Delete
}
[187] Fix | Delete
}
[188] Fix | Delete
[189] Fix | Delete
return new ET_Builder_Module_Field_Height();
[190] Fix | Delete
[191] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function