Project

General

Profile

Revision 560c3060

Added by Julien Enselme about 9 years ago

Update ctools 1.7 -> 1.9

View differences:

drupal7/sites/all/modules/ctools/page_manager/page_manager.module
440 440
 */
441 441
function page_manager_handler_get_name($task_name, $handlers, $handler) {
442 442
  $base = str_replace('-', '_', $task_name);
443
  $name = '';
444

  
443 445
  // Optional machine name.
444 446
  if (!empty($handler->conf['name'])) {
445 447
    $name = $base . '__' . $handler->conf['name'];
448
    if (count(ctools_export_load_object('page_manager_handlers', 'names', array($name)))) {
449
      $name = '';
450
    }
446 451
  }
447 452

  
448
  // If no machine name was provided, generate a unique name.
449
  else {
453
  // If no machine name was provided or the name is in use, generate a unique name.
454
  if (empty($name)) {
450 455
    $base .= '__' . $handler->handler;
451 456

  
452 457
    // Use the ctools uuid generator to generate a unique id.
......
472 477

  
473 478
  if ($title) {
474 479
    $handler->conf['title'] = $title;
480
    $handler->conf['name'] = trim(preg_replace('/[^a-z0-9_]+/', '-', strtolower($title)), '-');
481
  }
482
  else {
483
    $handler->conf['name'] = '';
475 484
  }
476 485

  
477 486
  $name = page_manager_handler_get_name($page->task_name, $page->handlers, $handler);

Also available in: Unified diff