You are here

public static function LPManagedContent::createWithValues in Opigno Learning path 8

Same name and namespace in other branches
  1. 3.x src/Entity/LPManagedContent.php \Drupal\opigno_learning_path\Entity\LPManagedContent::createWithValues()

Creates a new LPManagedContent object with the values passed in param.

It's not saved automatically. You need to do $obj->save().

Parameters

int $learning_path_id: The learning path group ID.

string $lp_content_type_id: The content type plugin ID.

int $entity_id: The drupal entity ID.

int $success_score_min: The minimum success score to pass the learning path.

int $is_mandatory: Set if the content is mandatory to pass the learning path.

int $coordinate_x: The X coordinate for this content in the learning path.

int $coordinate_y: The Y coordinate for this content in the learning path.

Return value

\Drupal\Core\Entity\EntityInterface|self LPManagedContent object.

1 call to LPManagedContent::createWithValues()
LearningPathManagerController::addItem in src/Controller/LearningPathManagerController.php
This method adds an item (content) in the learning path.

File

src/Entity/LPManagedContent.php, line 62

Class

LPManagedContent
Defines the Learning Path Content entity.

Namespace

Drupal\opigno_learning_path\Entity

Code

public static function createWithValues($learning_path_id, $lp_content_type_id, $entity_id, $success_score_min = 0, $is_mandatory = 0, $coordinate_x = 0, $coordinate_y = 0) {
  $values = [
    'learning_path_id' => $learning_path_id,
    'lp_content_type_id' => $lp_content_type_id,
    'entity_id' => $entity_id,
    'success_score_min' => $success_score_min,
    'is_mandatory' => $is_mandatory,
    'coordinate_x' => $coordinate_x,
    'coordinate_y' => $coordinate_y,
  ];
  return parent::create($values);
}