function breakpoints_admin_breakpoint_group_edit_form in Breakpoints 7
1 string reference to 'breakpoints_admin_breakpoint_group_edit_form'
- breakpoints_menu in ./
breakpoints.module - Implements hook_menu().
File
- ./
breakpoints.admin.inc, line 714 - Breakpoints - admin settings
Code
function breakpoints_admin_breakpoint_group_edit_form($form, &$form_state, $machine_name = '') {
$form = array();
$group = breakpoints_breakpoint_group_load($machine_name);
$breakpoints = breakpoints_breakpoint_load_all();
if (empty($breakpoints)) {
return breakpoints_admin_breakpoint_group_edit_form_no_breakpoints();
}
$form_state['#breakpoint_group'] = $group;
$is_new = $machine_name == '';
$form_state['#is_new'] = $is_new;
$form['name'] = array(
'#type' => 'textfield',
'#size' => '64',
'#title' => t('group name'),
'#required' => TRUE,
'#default_value' => isset($group->name) ? $group->name : '',
'#disabled' => !$is_new,
);
$form['machine_name'] = array(
'#type' => 'machine_name',
'#size' => '64',
'#title' => t('Machine name'),
'#required' => TRUE,
'#default_value' => isset($group->machine_name) ? $group->machine_name : '',
'#disabled' => !$is_new,
'#machine_name' => array(
'exists' => 'breakpoints_breakpoint_group_name_exists',
),
);
foreach ($breakpoints as $breakpoint_name => $breakpoint) {
$options[$breakpoint_name] = $breakpoint->name . ' [' . $breakpoint->breakpoint . ']';
}
$form['breakpoints'] = array(
'#title' => 'Select the breakpoints you want to use in this group',
'#type' => 'checkboxes',
'#options' => $options,
'#default_value' => isset($group->breakpoints) ? drupal_map_assoc($group->breakpoints) : array(),
'#required' => TRUE,
);
// Buttons
$form['buttons'] = array(
'#type' => 'container',
);
// Submit button
$form['buttons']['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
);
if (!$is_new && $group->type == BREAKPOINTS_SOURCE_TYPE_CUSTOM) {
$form['buttons']['deletelink'] = array(
'#type' => 'markup',
'#markup' => l(t('Delete this group'), 'admin/config/media/breakpoints/groups/' . $group->machine_name . '/delete', array(
'query' => drupal_get_destination(),
)),
);
}
return $form;
}