public function UserSectionStorage::getEditors in Workbench Access 8
Gets a list of editors assigned to a section.
This method does not return editors assigned by role.
Parameters
\Drupal\workbench_access\Entity\AccessSchemeInterface $scheme: Access scheme.
string $id: The section id.
Return value
array An array keyed user ids with values of user labels (names).
Overrides UserSectionStorageInterface::getEditors
File
- src/
UserSectionStorage.php, line 160
Class
- UserSectionStorage
- Defines a class for storing and retrieving sections assigned to a user.
Namespace
Drupal\workbench_accessCode
public function getEditors(AccessSchemeInterface $scheme, $id) {
$query = $this
->sectionStorage()
->getAggregateQuery()
->condition('access_scheme', $scheme
->id())
->condition('section_id', $id)
->groupBy('user_id.target_id')
->groupBy('user_id.entity.name');
$data = $query
->execute();
$list = array_column($data, 'name', 'user_id_target_id');
// $list may return an array with a NULL element, which is not 'empty.'.
if (current($list)) {
return $list;
}
return [];
}