You are here

public function ContentTypeILT::getAllContents in Opigno Instructor-led Trainings 3.x

Same name and namespace in other branches
  1. 8 src/Plugin/OpignoGroupManagerContentType/ContentTypeILT.php \Drupal\opigno_ilt\Plugin\OpignoGroupManagerContentType\ContentTypeILT::getAllContents()

Get all the entities in an array of LearningPathContent.

Return value

LearningPathContent[]|false The contents or FALSE in case of error.

Overrides ContentTypeInterface::getAllContents

1 call to ContentTypeILT::getAllContents()
ContentTypeILT::getAvailableContents in src/Plugin/OpignoGroupManagerContentType/ContentTypeILT.php
Get all the published entities in an array of LearningPathContent.

File

src/Plugin/OpignoGroupManagerContentType/ContentTypeILT.php, line 144

Class

ContentTypeILT
Class ContentTypeILT.

Namespace

Drupal\opigno_ilt\Plugin\OpignoGroupManagerContentType

Code

public function getAllContents() {
  try {

    /** @var \Drupal\opigno_ilt\ILTInterface[] $entities */
    $entities = \Drupal::entityTypeManager()
      ->getStorage('opigno_ilt')
      ->loadMultiple();
  } catch (InvalidPluginDefinitionException $e) {

    // TODO: Log the error.
    return FALSE;
  }
  $contents = [];
  foreach ($entities as $entity) {
    $contents[] = $this
      ->getContent($entity);
  }
  return $contents;
}