1 layout.flexible.inc layout_flexible_template_settings_edit_form($form, &$form_state, LayoutFlexibleTemplate $flexible_template)

Form to configure a flexible template.

Parameters

LayoutFlexibleTemplate $flexible_template: The loaded flexible template object.

Related topics

File

core/modules/layout/layout.flexible.inc, line 29
Provides configurable (flexible) layout templates.

Code

function layout_flexible_template_settings_edit_form($form, &$form_state, LayoutFlexibleTemplate $flexible_template) {
  $form_state['flexible_template'] = $flexible_template;
  $template_exists = layout_flexible_template_load($flexible_template->name);

  $form['name'] = array(
    '#title' => t('Template name'),
    '#type' => 'textfield',
    '#maxlength' => 128,
    '#default_value' => $flexible_template->title,
    '#required' => TRUE,
  );
  $form['machine_name'] = array(
    '#type' => 'machine_name',
    '#maxlength' => 21,
    '#default_value' => $flexible_template->name,
    '#disabled' => ($template_exists && empty($flexible_template->is_new)),
    '#machine_name' => array(
      'exists' => 'layout_flexible_template_load',
    ),
  );
  $form['description'] = array(
    '#title' => t('Description'),
    '#type' => 'textfield',
    '#default_value' => $flexible_template->description,
  );

  $form['actions'] = array('#type' => 'actions');
  $form['actions']['submit'] = array(
    '#type' => 'submit',
    '#submit' => array(
      'layout_flexible_template_settings_form_submit',
    ),
    '#value' => t('Save and configure'),
  );
  $form['actions']['cancel'] = array(
    '#type' => 'submit',
    '#value' => t('Cancel'),
    '#validate' => array(),
    '#limit_validation_errors' => array(array('name', 'machine_name')),
    '#submit' => array(
      'layout_flexible_template_settings_form_cancel',
    ),
  );

  return $form;
}