You are here

function title_module_implements_alter in Title 7

Implements hook_module_implements_alter().

File

./title.module, line 27

Code

function title_module_implements_alter(&$implementations, $hook) {
  if (isset($implementations['title'])) {
    $group = $implementations['title'];
    unset($implementations['title']);
    switch ($hook) {

      // The following hook implementations should be executed as last ones.
      case 'entity_info_alter':
      case 'entity_presave':
      case 'field_attach_presave':
        $implementations['title'] = $group;
        break;

      // The following hook implementations should be executed after
      // entity_translation.
      case 'entity_load':
        if (isset($implementations['entity_translation'])) {
          $length = array_search('entity_translation', array_keys($implementations)) + 1;
          $implementations = array_merge(array_slice($implementations, 0, $length, TRUE), array(
            'title' => $group,
          ), array_slice($implementations, $length, count($implementations) - 1, TRUE));
        }
        break;

      // Normally Title needs to act as first module to perform synchronization.
      default:
        $implementations = array(
          'title' => $group,
        ) + $implementations;
    }
  }
}