You are here

public static function OpignoGroupManagedContent::createWithValues in Opigno group manager 3.x

Same name and namespace in other branches
  1. 8 src/Entity/OpignoGroupManagedContent.php \Drupal\opigno_group_manager\Entity\OpignoGroupManagedContent::createWithValues()

Helper to create a new LPManagedContent with the values passed in param.

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

Parameters

int $group_id: The learning path group ID.

string $group_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.

int $in_skills_system: Check if the content in the skills system.

Return value

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

3 calls to OpignoGroupManagedContent::createWithValues()
OpignoGroupManagerController::addItem in src/Controller/OpignoGroupManagerController.php
This method adds an item (content) in the learning path.
OpignoGroupManagerController::courseDuplicate in src/Controller/OpignoGroupManagerController.php
Duplicate course.
OpignoGroupManagerController::trainingDuplicate in src/Controller/OpignoGroupManagerController.php
Duplicate training.

File

src/Entity/OpignoGroupManagedContent.php, line 60

Class

OpignoGroupManagedContent
Defines the Opigno Group Content entity.

Namespace

Drupal\opigno_group_manager\Entity

Code

public static function createWithValues($group_id, $group_content_type_id, $entity_id, $success_score_min = 0, $is_mandatory = 0, $coordinate_x = 0, $coordinate_y = 0, $in_skills_system = 0) {
  $values = [
    'group_id' => $group_id,
    'group_content_type_id' => $group_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,
    'in_skills_system' => $in_skills_system,
  ];
  return parent::create($values);
}