You are here

function panels_common_get_keyword in Panels 6.2

Same name and namespace in other branches
  1. 5.2 includes/common.inc \panels_common_get_keyword()
1 call to panels_common_get_keyword()
panels_ajax_context_item_add in includes/common-context.inc
Ajax entry point to add an context

File

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

Code

function panels_common_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;
}