You are here

protected function ImportTrainingForm::importModule in Opigno module 8

Same name and namespace in other branches
  1. 3.x src/Form/ImportTrainingForm.php \Drupal\opigno_module\Form\ImportTrainingForm::importModule()

Create Opigno Module entity.

Parameters

array $module_content: List of settings from imported file.

Return value

OpignoModule

Throws

\Exception

1 call to ImportTrainingForm::importModule()
ImportTrainingForm::submitForm in src/Form/ImportTrainingForm.php
Form submission handler.

File

src/Form/ImportTrainingForm.php, line 542

Class

ImportTrainingForm
Import Course form.

Namespace

Drupal\opigno_module\Form

Code

protected function importModule($module_content) {
  $module = $this
    ->buildEntityOptions($module_content, 'opigno_module');
  $new_module = OpignoModule::create($module);
  if (!empty($module_content['description'][0])) {
    $new_module->description->format = $module_content['description'][0]['format'];
  }
  $new_module
    ->save();
  return $new_module;
}