function workspaces_module_implements_alter

Implements hook_module_implements_alter().

File

core/modules/workspaces/workspaces.module, line 41

Code

function workspaces_module_implements_alter(&$implementations, $hook) : void {
    // Move our 'hook_entity_presave' implementation at the beginning to ensure
    // that other presave implementations are aware of the changes done in
    // \Drupal\workspaces\EntityOperations::entityPresave().
    if ($hook === 'entity_presave') {
        $implementation = $implementations['workspaces'];
        $implementations = [
            'workspaces' => $implementation,
        ] + $implementations;
    }
    // Move our 'hook_entity_insert' implementation at the end to ensure that
    // the second (pending) revision created for published entities is not used
    // by other 'hook_entity_insert' implementations.
    // @see \Drupal\workspaces\EntityOperations::entityInsert()
    if ($hook === 'entity_insert') {
        $group = $implementations['workspaces'];
        unset($implementations['workspaces']);
        $implementations['workspaces'] = $group;
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.