You are here

function _variable_devel_export_definition in Variable Extra 7

Export variable definition.

3 calls to _variable_devel_export_definition()
variable_devel_page_definition in variable_devel/variable_devel.pages.inc
Print variable definition.
variable_devel_page_type in variable_devel/variable_devel.pages.inc
List variables by type.
_variable_devel_settings_form_alter in variable_devel/variable_devel.inc
Implements hook_variable_settings_form_alter()

File

variable_devel/variable_devel.inc, line 101

Code

function _variable_devel_export_definition($name, $definition, $type = 'variable') {
  $output = '<pre>';
  $output .= '$' . $type . "['{$name}'] = array(\n";
  foreach ($definition as $property => $value) {
    $output .= "  '" . check_plain($property) . "' => ";
    if ($property == 'title' || $property == 'description') {
      $output .= "t('" . check_plain($value) . "', array(), \$options)";
    }
    elseif (is_array($value)) {
      $output .= drupal_var_export($value, '  ');
    }
    else {
      $output .= is_int($value) ? $value : "'" . check_plain($value) . "'";
    }
    $output .= ",\n";
  }
  $output .= ');</pre>';
  return $output;
}