You are here

function features_dom_encode_options in Features 7

Same name and namespace in other branches
  1. 6 features.admin.inc \features_dom_encode_options()
  2. 7.2 features.admin.inc \features_dom_encode_options()

Make a Drupal options array safe for usage with jQuery DOM selectors. Encodes known bad characters into __[ordinal]__ so that they may be safely referenced by JS behaviors.

1 call to features_dom_encode_options()
features_export_form in ./features.admin.inc
Form constructor for features export form.

File

./features.admin.inc, line 841
@todo.

Code

function features_dom_encode_options($options = array(), $keys_only = TRUE) {
  $replacements = features_dom_encode_map();
  $encoded = array();
  foreach ($options as $key => $value) {
    $encoded[strtr($key, $replacements)] = $keys_only ? $value : strtr($value, $replacements);
  }
  return $encoded;
}