You are here

public function CourseObjectNode::optionsSubmit in Course 7.2

Same name and namespace in other branches
  1. 6 includes/course_object.core.inc \CourseObjectNode::optionsSubmit()
  2. 7 includes/CourseObjectNode.inc \CourseObjectNode::optionsSubmit()

Save object configs to cache.

Overrides CourseObject::optionsSubmit

2 calls to CourseObjectNode::optionsSubmit()
CourseObjectSignup::optionsSubmit in modules/course_signup/course_signup.classes.inc
Set a specialized instance ID.
CourseObjectUbercart::optionsSubmit in modules/course_uc/course_uc.classes.inc
Set a specialized instance ID.
2 methods override CourseObjectNode::optionsSubmit()
CourseObjectSignup::optionsSubmit in modules/course_signup/course_signup.classes.inc
Set a specialized instance ID.
CourseObjectUbercart::optionsSubmit in modules/course_uc/course_uc.classes.inc
Set a specialized instance ID.

File

includes/CourseObjectNode.inc, line 255

Class

CourseObjectNode
A course object that uses a node as a base.

Code

public function optionsSubmit(&$form, &$form_state) {
  if (isset($form_state['values']['instance'])) {
    $nid = $form_state['values']['instance'];
    if (!is_numeric($nid)) {
      if (preg_match('/^(?:\\s*|(.*) )?\\[\\s*nid\\s*:\\s*(\\d+)\\s*\\]$/', $nid, $matches)) {
        $nid = $matches[2];
      }
    }
    if ($nid) {
      $form_state['values']['instance'] = $nid;
    }
    else {

      // Unset it, or we'll erase the relationship (since the textfield is
      // actually blank).
      unset($form_state['values']['instance']);
    }
  }
  parent::optionsSubmit($form, $form_state);
}