function ctools_get_keyword

1 call to ctools_get_keyword()
ctools_context_get_defaults in includes/context-admin.inc
Get the defaults for a new instance of a context plugin.

File

includes/context-admin.inc, line 831

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 = 1;
    while (!empty($keywords[$keyword])) {
        $keyword = $word . '_' . ++$count;
    }
    return $keyword;
}