1 layout.module layout_get_handler_name($plugin_type, $plugin_name)

Helper function to get a handler class name based on the plugin name.

File

core/modules/layout/layout.module, line 1416
The Layout module creates pages and wraps existing pages in layouts.

Code

function layout_get_handler_name($plugin_type, $plugin_name) {
  // Block "plugins" for Layouts are wrappers around the generic block system.
  $broken_class = NULL;
  if ($plugin_type === 'block') {
    list($module, $delta) = explode(':', $plugin_name);
    $info = layout_get_block_info($module, $delta);
    if ($info) {
      if (isset($info['class'])) {
        $class_name = $info['class'];
      }
      else {
        $class_name = 'BlockLegacy';
      }
    }
    else {
      $class_name = 'BlockBroken';
    }
  }
  else {
    $info = _layout_get_all_info($plugin_type);
    switch ($plugin_type) {
      case 'layout_access':
        $broken_class = 'LayoutAccessBroken';
        break;
      case 'layout_context':
        $broken_class = 'LayoutContextBroken';
        break;
      case 'layout_style':
        $broken_class = 'LayoutStyle';
        break;
    }

    if (isset($info[$plugin_name]['class']) && class_exists($info[$plugin_name]['class'])) {
      $class_name = $info[$plugin_name]['class'];
    }
    else {
      $class_name = $broken_class;
    }
  }
  return $class_name;
}