You are here

public function CourseObject::optionsSubmit in Course 3.x

Same name and namespace in other branches
  1. 8.3 src/Entity/CourseObject.php \Drupal\course\Entity\CourseObject::optionsSubmit()
  2. 8.2 src/Entity/CourseObject.php \Drupal\course\Entity\CourseObject::optionsSubmit()

Save object configs to cache.

Overrides CourseHandler::optionsSubmit

3 calls to CourseObject::optionsSubmit()
CourseObjectCommerce::optionsSubmit in modules/course_commerce/src/Plugin/course/CourseObject/CourseObjectCommerce.php
Set a specialized instance ID.
CourseObjectNode::optionsSubmit in modules/course_content/src/Course/Object/CourseObjectNode.php
Save object configs to cache.
CourseObjectUbercart::optionsSubmit in modules/course_uc/src/Plugin/course/CourseObject/CourseObjectUbercart.php
Set a specialized instance ID.
3 methods override CourseObject::optionsSubmit()
CourseObjectCommerce::optionsSubmit in modules/course_commerce/src/Plugin/course/CourseObject/CourseObjectCommerce.php
Set a specialized instance ID.
CourseObjectNode::optionsSubmit in modules/course_content/src/Course/Object/CourseObjectNode.php
Save object configs to cache.
CourseObjectUbercart::optionsSubmit in modules/course_uc/src/Plugin/course/CourseObject/CourseObjectUbercart.php
Set a specialized instance ID.

File

src/Entity/CourseObject.php, line 348

Class

CourseObject
Parent abstract base class of all course objects.

Namespace

Drupal\course\Entity

Code

public function optionsSubmit(&$form, FormStateInterface $form_state) {
  $uniqid = $this
    ->id();
  $course = $form_state
    ->getBuildInfo()['args'][0];
  $cid = $course
    ->id();

  // Start editing session.
  course_editing_start($this
    ->getCourse());

  // Flip 'visible' so it behaves like 'hidden'.
  if ($form_state
    ->getValue('hidden')) {
    $form_state
      ->setValue('hidden', $form_state
      ->getValue('hidden') != 1);
  }

  // Object-specific settings
  $_SESSION['course'][$cid]['editing'][$uniqid] = $form_state
    ->getValues() + $_SESSION['course'][$cid]['editing'][$uniqid];
}