You are here

function ctools_get_keyword in Chaos Tool Suite (ctools) 6

Same name and namespace in other branches
  1. 7 includes/context-admin.inc \ctools_get_keyword()
1 call to ctools_get_keyword()
ctools_context_ajax_item_add in includes/context-admin.inc
Ajax entry point to add an context

File

includes/context-admin.inc, line 990
includes/common-context.inc Provide API for adding contexts for modules that embed displays.

Code

function ctools_get_keyword($page, $word) {

  // Create a complete set of keywords
  $keywords = array();
  foreach (array(
    'arguments',
    'relationships',
    'contexts',
    'requiredcontexts',
  ) as $type) {
    if (!empty($page->{$type}) && is_array($page->{$type})) {
      foreach ($page->{$type} as $info) {
        $keywords[$info['keyword']] = TRUE;
      }
    }
  }
  $keyword = $word;
  $count = 0;
  while (!empty($keywords[$keyword])) {
    $keyword = $word . '_' . ++$count;
  }
  return $keyword;
}