public static function LPManagedContent::getFirstStep in Opigno Learning path 3.x
Same name and namespace in other branches
- 8 src/Entity/LPManagedContent.php \Drupal\opigno_learning_path\Entity\LPManagedContent::getFirstStep()
Returns first step.
File
- src/
Entity/ LPManagedContent.php, line 348
Class
- LPManagedContent
- Defines the Learning Path Content entity.
Namespace
Drupal\opigno_learning_path\EntityCode
public static function getFirstStep($learning_path_id) {
// The first step is the content who has no parents.
// First, get all the contents.
$contents = self::loadByLearningPathId($learning_path_id);
// Then, check which content has no parent link.
foreach ($contents as $content) {
$parents = $content
->getParentsLinks();
if (empty($parents)) {
return $content;
}
}
return FALSE;
}