function ctools_context_keyword_substitute

cis7 context.inc ctools_context_keyword_substitute($string, $keywords, $contexts, $converter_options = array())
cle7 context.inc ctools_context_keyword_substitute($string, $keywords, $contexts, $converter_options = array())
elmsmedia7 context.inc ctools_context_keyword_substitute($string, $keywords, $contexts, $converter_options = array())
icor7 context.inc ctools_context_keyword_substitute($string, $keywords, $contexts, $converter_options = array())
meedjum_blog7 context.inc ctools_context_keyword_substitute($string, $keywords, $contexts, $converter_options = array())
mooc7 context.inc ctools_context_keyword_substitute($string, $keywords, $contexts, $converter_options = array())

Perform keyword and context substitutions.

6 calls to ctools_context_keyword_substitute()
ctools_content_render in sites/all/modules/ulmus/ctools/includes/content.inc
Get the content from a given content type.
ctools_custom_content_type_render in sites/all/modules/ulmus/ctools/plugins/content_types/custom/custom.inc
Output function for the 'custom' content type. Outputs a custom based on the module and delta supplied in the configuration.
ds_extras_entity_view_alter in sites/all/modules/ulmus/ds/modules/ds_extras/ds_extras.module
Implements hook_entity_view_alter().
page_manager_http_response_render in sites/all/modules/ulmus/ctools/page_manager/plugins/task_handlers/http_response.inc
views_content_views_panes_content_type_render in sites/all/modules/ulmus/ctools/views_content/plugins/content_types/views_panes.inc
Output function for the 'views' content type.

... See full list

File

sites/all/modules/ulmus/ctools/includes/context.inc, line 633
Contains code related to the ctools system of 'context'.

Code

function ctools_context_keyword_substitute($string, $keywords, $contexts, $converter_options = array()) {
  // Ensure a default keyword exists:
  $keywords['%%'] = '%';

  // Match contexts to the base keywords:
  $context_keywords = array();
  foreach ($contexts as $context) {
    if (isset($context->keyword)) {
      $context_keywords[$context->keyword] = $context;
    }
  }

  // Look for context matches we we only have to convert known matches.
  $matches = array();
  if (preg_match_all('/%(%|[a-zA-Z0-9_-]+(?:\:[a-zA-Z0-9_-]+)*)/us', $string, $matches)) {
    foreach ($matches[1] as $keyword) {
      // Ignore anything it finds with %%.
      if ($keyword[0] == '%') {
        continue;
      }

      // If the keyword is already set by something passed in, don't try to
      // overwrite it.
      if (!empty($keywords['%' . $keyword])) {
        continue;
      }

      // Figure out our keyword and converter, if specified.
      if (strpos($keyword, ':')) {
        list($context, $converter) = explode(':', $keyword, 2);
      }
      else {
        $context = $keyword;
        if (isset($context_keywords[$keyword])) {
          $plugin = ctools_get_context($context_keywords[$context]->plugin);

          // Fall back to a default converter, if specified.
          if ($plugin && !empty($plugin['convert default'])) {
            $converter = $plugin['convert default'];
          }
        }
      }

      if (empty($context_keywords[$context]) || !empty($context_keywords[$context]->empty)) {
        $keywords['%' . $keyword] = '';
      }
      else if (!empty($converter)) {
        $keywords['%' . $keyword] = ctools_context_convert_context($context_keywords[$context], $converter, $converter_options);
      }
      else {
        $keywords['%' . $keyword] = $context_keywords[$keyword]->title;
      }
    }
  }
  return strtr($string, $keywords);
}
Error | ELMSLN API

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/elmsln_community/api.elmsln.org/includes/common.inc:2791) in drupal_send_headers() (line 1499 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).
  • Error: Call to undefined function apc_delete() in DrupalAPCCache->clear() (line 289 of /var/www/html/elmsln_community/api.elmsln.org/sites/all/modules/apc/drupal_apc_cache.inc).
The website encountered an unexpected error. Please try again later.