You are here

function datex_schema_edit_form in Datex 7.3

Same name and namespace in other branches
  1. 7.2 datex.admin.inc \datex_schema_edit_form()

Menu callback, Admin form for editing datex schema.

1 string reference to 'datex_schema_edit_form'
datex_menu in ./datex.module
Implements hook_menu().

File

./datex.admin.inc, line 181
Datex administration forms.

Code

function datex_schema_edit_form($form, $form_state, $name) {
  $list = array_keys(variable_get('datex_schema', []));
  if (!in_array($name, $list)) {
    $form['notfound'] = [
      '#markup' => t('Not found'),
    ];
    return $form;
  }
  $schema = variable_get('datex_schema');
  $default = $schema[$name];
  $form['schemaname'] = [
    '#type' => 'markup',
    '#markup' => '<h2> Editing: ' . '<b>' . check_plain($name) . '</b></h2>',
  ];
  $form['name'] = [
    '#type' => 'value',
    '#value' => $name,
  ];
  foreach (language_list() as $code => $lang) {
    $t = [
      '@name' => $lang->name,
      '@native' => $lang->native,
    ];
    $form['datex_' . $code] = [
      '#type' => 'select',
      '#title' => t('Used calendar in @name (@native)', $t),
      '#options' => [
        '' => 'Disabled',
      ] + _datex_available_calendars(),
      '#default_value' => isset($default[$code]) ? $default[$code] : '',
    ];
  }
  $form['actions']['submit'] = [
    '#type' => 'submit',
    '#value' => t('Save'),
    '#submit' => [
      '_datex_schema_edit_form_submit',
    ],
  ];
  return $form;
}