You are here

function layout_responsive_settings_form in Layout 7

Form callback. Add our form elements for data interchange.

1 string reference to 'layout_responsive_settings_form'
responsive.inc in plugins/layouts/responsive.inc

File

plugins/layouts/responsive.inc, line 33

Code

function layout_responsive_settings_form($display, $layout, $layout_settings) {

  // We never draw stored responsive layouts in admin mode; they must be edited
  // from the stored layout UI at that point. This can happen if the layout is
  // displayed in an admin context, but not to administer the layout per say but
  // to administer other thigns on top of the layout, such as rearranging panes
  // when switching layouts or when adding new panes.
  if (!empty($layout['layout'])) {
    return;
  }
  layout_responsive_merge_default_settings($layout_settings, $layout);
  $layoutdata = array();
  $default_regions = layout_region_load_all();
  foreach ($layout_settings['regions'] as $name => $name) {
    $layoutdata['regions'][] = array(
      'name' => $name,
      'admin_title' => $default_regions[$name]->admin_title,
    );
  }
  $layoutdata['overrides'] = $layout_settings['overrides'];
  $form = array();
  $form['layout_responsive_regions'] = array(
    '#type' => 'textarea',
    '#title' => t('Region and breakpoint configuration'),
    '#default_value' => drupal_json_encode($layoutdata),
  );
  return $form;
}