You are here

function context_export in Context 6.3

Same name and namespace in other branches
  1. 7.3 context.module \context_export()

Exports the specified context.

1 string reference to 'context_export'
context_schema in ./context.install
Implementation of hook_schema().

File

./context.module, line 264

Code

function context_export($context, $indent = '') {
  $output = ctools_export_object('context', $context, $indent);
  $translatables = array();
  foreach (array(
    'description',
    'tag',
  ) as $key) {
    if (!empty($context->{$key})) {
      $translatables[] = $context->{$key};
    }
  }
  $translatables = array_filter(array_unique($translatables));
  if (!empty($translatables)) {
    $output .= "\n";
    $output .= "{$indent}// Translatables\n";
    $output .= "{$indent}// Included for use with string extractors like potx.\n";
    sort($translatables);
    foreach ($translatables as $string) {
      $output .= "{$indent}t(" . ctools_var_export($string) . ");\n";
    }
  }
  return $output;
}