function page_manager_handler_get_name

Generate a unique name for a task handler.

Task handlers need to be named but they aren't allowed to set their own names. Instead, they are named based upon their parent task and type.

1 call to page_manager_handler_get_name()
page_manager_handler_add_to_page in page_manager/page_manager.module
Import a handler into a page.

File

page_manager/page_manager.module, line 440

Code

function page_manager_handler_get_name($task_name, $handlers, $handler) {
    $base = str_replace('-', '_', $task_name);
    $name = '';
    // Optional machine name.
    if (!empty($handler->conf['name'])) {
        $name = $base . '__' . $handler->conf['name'];
        if (count(ctools_export_load_object('page_manager_handlers', 'names', array(
            $name,
        )))) {
            $name = '';
        }
    }
    // If no machine name was provided or the name is in use, generate a unique name.
    if (empty($name)) {
        $base .= '__' . $handler->handler;
        // Use the ctools uuid generator to generate a unique id.
        $name = $base . '_' . ctools_uuid_generate();
    }
    return $name;
}