You are here

function panels_bootstrap_add_item_form in Panels Bootstrap Layout Builder 7

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

Form to add a row, column or region to a bootstrap layout.

Parameters

<type> $form_state:

Return value

<type>

1 string reference to 'panels_bootstrap_add_item_form'
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.

File

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

Code

function panels_bootstrap_add_item_form($form, &$form_state) {
  $display =& $form_state['display'];
  $item =& $form_state['item'];
  $parent =& $form_state['parent'];
  $settings =& $form_state['settings'];
  $location =& $form_state['location'];
  $id =& $form_state['id'];
  if ($item['type'] == 'row' || $item['type'] == 'canvas') {
    $form['grid_type'] = array(
      '#type' => 'select',
      '#title' => t('Grid type'),
      '#default_value' => $item['grid_type'],
      '#options' => array(
        'row-fluid' => t('Fluid'),
        'row' => t('Basic'),
      ),
    );
  }
  if ($item['type'] == 'region') {
    $form['title'] = array(
      '#title' => t('Region title'),
      '#type' => 'textfield',
      '#default_value' => $item['title'],
      '#required' => TRUE,
    );
  }
  $form['class'] = array(
    '#title' => t('CSS Class'),
    '#type' => 'textfield',
    '#default_value' => isset($item['class']) ? $item['class'] : '',
    '#description' => t('Enter a CSS class that will be used. This can be used to apply automatic styling from your theme, for example.'),
  );
  if ($item['type'] != 'row') {

    // now config for the row
  }
  else {
    $form['contains'] = array(
      '#type' => 'select',
      '#title' => t('Contains'),
      '#default_value' => $item['contains'],
      '#options' => array(
        'region' => t('Regions'),
        'column' => t('Columns'),
      ),
    );
  }
  $form['save'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  return $form;
}