You are here

public static function WorkbenchAccessManager::getAllSections in Workbench Access 8

Returns a flat array of all active section ids.

Used to display assignments for admins.

Parameters

\Drupal\workbench_access\Entity\AccessSchemeInterface $scheme: Access scheme.

bool $root_only: If TRUE, only show the root-level assignments.

Return value

array All sections for given scheme.

Overrides WorkbenchAccessManagerInterface::getAllSections

1 call to WorkbenchAccessManager::getAllSections()
Section::getValueOptions in src/Plugin/views/filter/Section.php
Child classes should be used to override this function and set the 'value options', unless 'options callback' is defined as a valid function or static public method to generate these values.

File

src/WorkbenchAccessManager.php, line 124

Class

WorkbenchAccessManager
Defines a class for interacting with content and fields.

Namespace

Drupal\workbench_access

Code

public static function getAllSections(AccessSchemeInterface $scheme, $root_only = FALSE) {
  $sections = [];
  foreach ($scheme
    ->getAccessScheme()
    ->getTree() as $root => $item) {
    if ($root_only) {
      $sections[] = $root;
    }
    else {
      foreach ($item as $id => $data) {
        $sections[] = $id;
      }
    }
  }
  return $sections;
}