You are here

function _menu_views_tokens_callback in Menu Views 7

Callback for human-readable token value replacements.

1 string reference to '_menu_views_tokens_callback'
MenuViews::tokenize_arguments in includes/menu_views.class.inc
Filters arguments and tokens for view argument. Render a view inside a menu link.

File

includes/tokens.inc, line 95
Token hooks for the menu_views module.

Code

function _menu_views_tokens_callback(&$replacements, $data, $options) {
  foreach ($replacements as $token => $value) {
    if ($options['human_readable']) {
      if (is_bool($value)) {
        $value = $value ? t('TRUE') : t('FALSE');
      }
      elseif (is_object($value)) {
        $value = t('Object');
      }
      elseif (is_array($value)) {
        $value = t('Array');
      }
      elseif (is_null($value)) {
        $value = t('NULL');
      }
      else {
        $value = (string) $value;
      }
      if ($value === '') {
        $value = t('NULL');
      }
    }
    $replacements[$token] = urlencode($value);
  }
}