You are here

function breakpoints_admin_breakpoint_group_duplicate_form in Breakpoints 7

Duplicate group form.

1 string reference to 'breakpoints_admin_breakpoint_group_duplicate_form'
breakpoints_menu in ./breakpoints.module
Implements hook_menu().

File

./breakpoints.admin.inc, line 1153
Breakpoints - admin settings

Code

function breakpoints_admin_breakpoint_group_duplicate_form($form, &$form_state, $breakpoint_group_name) {
  $form = array();
  $src_group = breakpoints_breakpoint_group_load($breakpoint_group_name);
  $form_state['#src_group'] = $src_group;
  $form['#attached']['css'][] = drupal_get_path('module', 'breakpoints') . '/css/breakpoints.admin.css';
  $form['name'] = array(
    '#type' => 'textfield',
    '#size' => '64',
    '#title' => t('New group name'),
    '#required' => TRUE,
    '#default_value' => t('Duplicate of') . ' ' . $src_group->name,
  );
  $form['machine_name'] = array(
    '#type' => 'machine_name',
    '#size' => '64',
    '#title' => t('Machine name'),
    '#required' => TRUE,
    '#default_value' => '',
    '#machine_name' => array(
      'exists' => 'breakpoints_breakpoint_group_name_exists',
    ),
  );

  // Buttons
  $form['buttons'] = array(
    '#type' => 'container',
  );

  // Submit button
  $form['buttons']['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  $form['buttons']['cancellink'] = array(
    '#type' => 'markup',
    '#markup' => l(t('Cancel'), 'admin/config/media/breakpoints/groups/' . $src_group->machine_name, array(
      'attributes' => array(
        'class' => array(
          'breakpoints-group-operations-link',
          'breakpoints-group-operations-cancel-link',
        ),
      ),
    )),
  );
  return $form;
}