You are here

function responsive_preview_device_edit_form in Responsive Theme Preview 7

Form builder for the device editing form.

Parameters

$form: An associative array containing the structure of the form.

$form_state: An associative array containing the current state of the form.

$name: (Optional) A string that identifies a device by its unique name.

Return value

An array representing the form definition.

See also

responsive_preview_device_edit_form_submit()

responsive_preview_device_edit_form_validate()

1 string reference to 'responsive_preview_device_edit_form'
responsive_preview_menu in ./responsive_preview.module
Implements hook_menu().

File

./responsive_preview.admin.inc, line 207
Administrative page callbacks for the responsive_preview module.

Code

function responsive_preview_device_edit_form($form, &$form_state, $name = '') {
  $devices = responsive_preview_get_device_definition($name);
  $device = $devices[$name];
  if (!empty($device)) {
    $form += responsive_preview_device_configuration_form($device);
    $form['actions'] = array(
      '#type' => 'actions',
    );
    $form['actions']['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Save'),
    );
  }
  else {
    drupal_set_message(t('No device found for %name.', array(
      '%name' => $name,
    )), 'warning');
  }
  return $form;
}