You are here

public function GroupContentMenuListBuilder::load in Group Content Menu 8

Loads entities of this type from storage for listing.

This allows the implementation to manipulate the listing, like filtering or sorting the loaded entities.

Return value

\Drupal\Core\Entity\EntityInterface[] An array of entities implementing \Drupal\Core\Entity\EntityInterface indexed by their IDs. Returns an empty array if no matching entities are found.

Overrides EntityListBuilder::load

File

src/GroupContentMenuListBuilder.php, line 66

Class

GroupContentMenuListBuilder
Provides a list controller for the group content menu entity type.

Namespace

Drupal\group_content_menu

Code

public function load() {
  $group = \Drupal::routeMatch()
    ->getParameter('group');
  if ($group) {
    return array_map(static function (GroupContentInterface $group_content) {
      return $group_content
        ->getEntity();
    }, group_content_menu_get_menus_per_group($group));
  }
  return [];
}