if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
* Elementor section element.
* Elementor section handler class is responsible for initializing the section
class Element_Section extends Element_Base {
* Section predefined columns presets.
* Holds the predefined columns width for each columns count available by
* default by Elementor. Default is an empty array.
* Note that when the user creates a section he can define custom sizes for
* the columns. But Elementor sets default values for predefined columns.
* For example two columns 50% width each one, or three columns 33.33% each
* one. This property hold the data for those preset values.
* @var array Section presets.
private static $presets = [];
* Retrieve the element type, in this case `section`.
* @return string The type.
public static function get_type() {
* Retrieve the section name.
* @return string Section name.
public function get_name() {
* Retrieve the section title.
* @return string Section title.
public function get_title() {
return esc_html__( 'Section', 'elementor' );
* Retrieve the section icon.
* @return string Section icon.
public function get_icon() {
protected function is_dynamic_content(): bool {
* Retrieve a specific preset columns for a given columns count, or a list
* of all the preset if no parameters passed.
* @param int $columns_count Optional. Columns count. Default is null.
* @param int $preset_index Optional. Preset index. Default is null.
* @return array Section presets.
public static function get_presets( $columns_count = null, $preset_index = null ) {
if ( ! self::$presets ) {
$presets = self::$presets;
if ( null !== $columns_count ) {
$presets = $presets[ $columns_count ];
if ( null !== $preset_index ) {
$presets = $presets[ $preset_index ];
* Initializing the section presets and set the number of columns the
* section can have by default. For example a column can have two columns
* 50% width each one, or three columns 33.33% each one.
* Note that Elementor sections have default section presets but the user
* can set custom number of columns and define custom sizes for each column.
public static function init_presets() {
'preset' => [ 25, 25, 50 ],
'preset' => [ 50, 25, 25 ],
'preset' => [ 25, 50, 25 ],
'preset' => [ 16, 66, 16 ],
foreach ( range( 1, 10 ) as $columns_count ) {
self::$presets[ $columns_count ] = [
$preset_unit = floor( 1 / $columns_count * 100 );
for ( $i = 0; $i < $columns_count; $i++ ) {
self::$presets[ $columns_count ][0]['preset'][] = $preset_unit;
if ( ! empty( $additional_presets[ $columns_count ] ) ) {
self::$presets[ $columns_count ] = array_merge( self::$presets[ $columns_count ], $additional_presets[ $columns_count ] );
foreach ( self::$presets[ $columns_count ] as $preset_index => & $preset ) {
$preset['key'] = $columns_count . $preset_index;
* Retrieve the current section initial configuration.
* Adds more configuration on top of the controls list, the tabs assigned to
* the control, element name, type, icon and more. This method also adds
* @return array The initial config.
protected function get_initial_config() {
$config = parent::get_initial_config();
$config['presets'] = self::get_presets();
$config['controls'] = $this->get_controls();
$config['tabs_controls'] = $this->get_tabs_controls();
* Register section controls.
* Used to add new controls to the section element.
protected function register_controls() {
$this->start_controls_section(
'label' => esc_html__( 'Layout', 'elementor' ),
'tab' => Controls_Manager::TAB_LAYOUT,
// Element Name for the Navigator.
'label' => esc_html__( 'Title', 'elementor' ),
'type' => Controls_Manager::HIDDEN,
'label' => esc_html__( 'Content Width', 'elementor' ),
'type' => Controls_Manager::SELECT,
'boxed' => esc_html__( 'Boxed', 'elementor' ),
'full_width' => esc_html__( 'Full Width', 'elementor' ),
'prefix_class' => 'elementor-section-',
$this->add_responsive_control(
'label' => esc_html__( 'Width', 'elementor' ),
'type' => Controls_Manager::SLIDER,
'{{WRAPPER}} > .elementor-container' => 'max-width: {{SIZE}}{{UNIT}};',
'label' => esc_html__( 'Columns Gap', 'elementor' ),
'type' => Controls_Manager::SELECT,
'default' => esc_html__( 'Default', 'elementor' ),
'no' => esc_html__( 'No Gap', 'elementor' ),
'narrow' => esc_html__( 'Narrow', 'elementor' ),
'extended' => esc_html__( 'Extended', 'elementor' ),
'wide' => esc_html__( 'Wide', 'elementor' ),
'wider' => esc_html__( 'Wider', 'elementor' ),
'custom' => esc_html__( 'Custom', 'elementor' ),
$this->add_responsive_control(
'label' => esc_html__( 'Custom Columns Gap', 'elementor' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', '%', 'em', 'rem', 'vh', 'vw', 'custom' ],
'{{WRAPPER}} .elementor-column-gap-custom .elementor-column > .elementor-element-populated' => 'padding: {{SIZE}}{{UNIT}};',
'label' => esc_html__( 'Height', 'elementor' ),
'type' => Controls_Manager::SELECT,
'default' => esc_html__( 'Default', 'elementor' ),
'full' => esc_html__( 'Fit To Screen', 'elementor' ),
'min-height' => esc_html__( 'Min Height', 'elementor' ),
'prefix_class' => 'elementor-section-height-',
$this->add_responsive_control(
'label' => esc_html__( 'Minimum Height', 'elementor' ),
'type' => Controls_Manager::SLIDER,
'size_units' => [ 'px', 'em', 'rem', 'vh', 'vw', 'custom' ],
'{{WRAPPER}} > .elementor-container' => 'min-height: {{SIZE}}{{UNIT}};',
'height' => [ 'min-height' ],
'label' => esc_html__( 'Height', 'elementor' ),
'type' => Controls_Manager::SELECT,
'default' => esc_html__( 'Default', 'elementor' ),
'full' => esc_html__( 'Fit To Screen', 'elementor' ),
'min-height' => esc_html__( 'Min Height', 'elementor' ),
'prefix_class' => 'elementor-section-height-',
$this->add_responsive_control(
'label' => esc_html__( 'Minimum Height', 'elementor' ),
'type' => Controls_Manager::SLIDER,
'{{WRAPPER}} > .elementor-container' => 'min-height: {{SIZE}}{{UNIT}};',
'height_inner' => [ 'min-height' ],
'size_units' => [ 'px', 'em', 'rem', 'vh', 'vw', 'custom' ],
'label' => esc_html__( 'Column Position', 'elementor' ),
'type' => Controls_Manager::SELECT,
'stretch' => esc_html__( 'Stretch', 'elementor' ),
'top' => esc_html__( 'Top', 'elementor' ),
'middle' => esc_html__( 'Middle', 'elementor' ),
'bottom' => esc_html__( 'Bottom', 'elementor' ),
'prefix_class' => 'elementor-section-items-',
'height' => [ 'full', 'min-height' ],
'label' => esc_html__( 'Vertical Align', 'elementor' ),
'type' => Controls_Manager::SELECT,
'' => esc_html__( 'Default', 'elementor' ),
'top' => esc_html__( 'Top', 'elementor' ),
'middle' => esc_html__( 'Middle', 'elementor' ),
'bottom' => esc_html__( 'Bottom', 'elementor' ),
'space-between' => esc_html__( 'Space Between', 'elementor' ),
'space-around' => esc_html__( 'Space Around', 'elementor' ),
'space-evenly' => esc_html__( 'Space Evenly', 'elementor' ),
'selectors_dictionary' => [
'{{WRAPPER}} > .elementor-container > .elementor-column > .elementor-widget-wrap' => 'align-content: {{VALUE}}; align-items: {{VALUE}};',
// TODO: The following line is for BC since 2.7.0.
'prefix_class' => 'elementor-section-content-',
'label' => esc_html__( 'Overflow', 'elementor' ),
'type' => Controls_Manager::SELECT,
'' => esc_html__( 'Default', 'elementor' ),
'hidden' => esc_html__( 'Hidden', 'elementor' ),
'{{WRAPPER}}' => 'overflow: {{VALUE}}',
'label' => esc_html__( 'Stretch Section', 'elementor' ),
'type' => Controls_Manager::SWITCHER,
'return_value' => 'section-stretched',
'prefix_class' => 'elementor-',
'description' => sprintf(
'%1$s <a href="https://go.elementor.com/stretch-section/" target="_blank">%2$s</a>',
esc_html__( 'Stretch the section to the full width of the page using JS.', 'elementor' ),
esc_html__( 'Learn more', 'elementor' )
'frontend_available' => true,
'' => esc_html__( 'Default', 'elementor' ),
] + array_combine( $possible_tags, $possible_tags );
'label' => esc_html__( 'HTML Tag', 'elementor' ),
'type' => Controls_Manager::SELECT,