You are here

function breakpoints_admin_breakpoint_group_export_form in Breakpoints 7

Export a group.

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

File

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

Code

function breakpoints_admin_breakpoint_group_export_form($form, &$form_state, $machine_name) {

  // Create the export code textarea.
  ctools_include('export');
  $group = breakpoints_breakpoint_group_load($machine_name);
  if (!$group || !$machine_name) {
    $group = new stdClass();
  }
  $group_export = ctools_export_crud_export('breakpoint_group', $group);
  $form['group_export'] = array(
    '#type' => 'textarea',
    '#title' => t('Breakpoint group code'),
    '#rows' => count(explode("\n", $group_export)),
    '#default_value' => $group_export,
  );
  $breakpoints_export = NULL;
  if (isset($group->breakpoints)) {
    foreach ($group->breakpoints as $breakpoint) {
      if (!is_array($breakpoint) && !is_object($breakpoint)) {
        $breakpoint = breakpoints_breakpoint_load_by_fullkey($breakpoint);
      }
      $breakpoints_export .= ctools_export_object('breakpoints', $breakpoint);
      $breakpoints_export .= "\n";
    }
  }
  $form['breakpoints_export'] = array(
    '#type' => 'textarea',
    '#title' => t('Breakpoints code'),
    '#rows' => count(explode("\n", $breakpoints_export)),
    '#default_value' => $breakpoints_export,
  );
  return $form;
}