You are here

function panels_bootstrap_convert_settings in Panels Bootstrap Layout Builder 7.3

Same name and namespace in other branches
  1. 7 plugins/layouts/bootstrap/bootstrap.inc \panels_bootstrap_convert_settings()

Convert settings from old style to new, or provide defaults for empty settings.

Parameters

<type> $settings:

8 calls to panels_bootstrap_convert_settings()
panels_ajax_bootstrap_edit_add in plugins/layouts/bootstrap/bootstrap.inc
AJAX responder to add a new row, column or region to a bootstrap layout.
panels_ajax_bootstrap_edit_remove in plugins/layouts/bootstrap/bootstrap.inc
AJAX responder to remove an existing row, column or region from a bootstrap layout.
panels_ajax_bootstrap_edit_resize in plugins/layouts/bootstrap/bootstrap.inc
AJAX responder to store resize information when the user adjusts the splitter.
panels_ajax_bootstrap_edit_reuse in plugins/layouts/bootstrap/bootstrap.inc
AJAX form to bring up the "reuse" modal.
panels_ajax_bootstrap_edit_settings in plugins/layouts/bootstrap/bootstrap.inc
AJAX responder to edit bootstrap settings for an item.

... See full list

File

plugins/layouts/bootstrap/bootstrap.inc, line 86

Code

function panels_bootstrap_convert_settings(&$settings, &$layout) {

  // This indicates that this is a layout that they used the checkbox
  // on. The layout is still 'bootstrap' but it's actually pointing
  // to another stored one and we have to load it.
  if (!empty($settings['layout'])) {
    $layout = panels_get_layout('bootstrap:' . $settings['layout']);
  }
  if (!empty($layout['layout'])) {
    $settings = $layout['layout']->settings;
    if ($settings) {
      return $settings;
    }
  }
  if (empty($settings)) {

    // set up a default
    $settings = array(
      'items' => array(
        // The 'canvas' is a special row that does not get rendered
        // normally, but is used to contain the columns.
        'canvas' => array(
          'type' => 'container',
          'contains' => 'row',
          'children' => array(
            'main',
          ),
          'parent' => NULL,
          'element_id_default' => 1,
        ),
        'main' => array(
          'type' => 'row',
          'children' => array(
            'main-column',
          ),
          'parent' => 'canvas',
          'element_id_default' => 1,
        ),
        'main-column' => array(
          'type' => 'column',
          'contains' => 'region',
          'bootstrap_class' => array(
            'xs' => 'col-xs-12',
            'sm' => 'col-sm-12',
            'md' => 'col-md-12',
            'lg' => 'col-lg-12',
          ),
          'children' => array(
            'center',
          ),
          'parent' => 'main',
          'element_id_default' => 1,
        ),
        'center' => array(
          'type' => 'region',
          'title' => t('Center'),
          'parent' => 'main-column',
          'element_id_default' => 1,
        ),
      ),
    );
  }
}