You are here

function devel_variable_edit in Devel 5

Same name and namespace in other branches
  1. 6 devel.module \devel_variable_edit()
  2. 7 devel.pages.inc \devel_variable_edit()
1 string reference to 'devel_variable_edit'
devel_menu in ./devel.module
Implementation of hook_menu().

File

./devel.module, line 1007

Code

function devel_variable_edit($name) {
  $value = variable_get($name, 'not found');
  $form['name'] = array(
    '#type' => 'value',
    '#value' => $name,
  );
  $form['value'] = array(
    '#type' => 'item',
    '#title' => t('Old value'),
    // maybe check_plain() done by fapi
    '#value' => dpr($value, TRUE),
  );
  if (is_string($value) || is_numeric($value)) {
    $form['new'] = array(
      '#type' => 'textarea',
      '#title' => t('New value'),
      '#default_value' => $value,
    );
    $form['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Submit'),
    );
  }
  else {
    $form['new'] = array(
      '#type' => 'item',
      '#title' => t('New value'),
      '#value' => t('Sorry, complex variable types may not be edited yet. Use the <em>Execute PHP</em> block and the <a href="@variable-set-doc">variable_set()</a> function.', array(
        '@variable-set-doc' => 'http://api.drupal.org/api/HEAD/function/variable_set',
      )),
    );
  }
  drupal_set_title(check_plain($name));
  return $form;
}