function responsive_preview_admin_form in Responsive Theme Preview 7
Form callback: builds the page for administering devices.
Parameters
$form: An associative array containing the structure of the form.
$form_state: An associative array containing the current state of the form.
Return value
An array representing the form definition.
See also
responsive_preview_admin_form_validate()
responsive_preview_admin_form_submit()
1 string reference to 'responsive_preview_admin_form'
- responsive_preview_menu in ./
responsive_preview.module - Implements hook_menu().
File
- ./
responsive_preview.admin.inc, line 23 - Administrative page callbacks for the responsive_preview module.
Code
function responsive_preview_admin_form($form, &$form_state) {
$devices = responsive_preview_get_device_definition();
$form['devices'] = array();
foreach ($devices as $name => $device) {
$form['devices'][$name] = array(
'name' => array(
'#type' => 'value',
'#value' => $device['name'],
),
'label' => array(
'#markup' => check_plain($device['label']),
),
'status' => array(
'#type' => 'checkbox',
'#title' => t('Show %title in list', array(
'%title' => $device['label'],
)),
'#title_display' => 'invisible',
'#default_value' => $device['status'],
),
'dimensions' => array(
'#markup' => check_plain($device['width'] . 'x' . $device['height'] . ' (' . $device['dppx'] . ' dppx)'),
),
'weight' => array(
'#type' => 'weight',
'#title' => t('Weight for @title', array(
'@title' => $device['label'],
)),
'#title_display' => 'invisible',
'#default_value' => $device['weight'],
'#attributes' => array(
'class' => array(
'weight',
),
),
),
'edit' => array(
'#type' => 'link',
'#title' => t('edit'),
'#href' => 'admin/config/content/responsive-preview/' . $device['name'] . '/edit',
'#attributes' => array(
'title' => t('edit @label', array(
'@label' => $device['label'],
)),
),
),
'delete' => array(
'#type' => 'link',
'#title' => t('delete'),
'#href' => 'admin/config/content/responsive-preview/' . $device['name'] . '/delete',
'#attributes' => array(
'title' => t('delete @label', array(
'@label' => $device['label'],
)),
),
),
'#tree' => TRUE,
'#parents' => array(
'devices',
$name,
),
);
}
$form['actions'] = array(
'#type' => 'actions',
);
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
);
return $form;
}