public function CourseObject::optionsSubmit in Course 7
Same name and namespace in other branches
- 6 includes/course_object.core.inc \CourseObject::optionsSubmit()
- 7.2 includes/CourseObject.inc \CourseObject::optionsSubmit()
Save object configs to cache.
Overrides CourseHandler::optionsSubmit
1 call to CourseObject::optionsSubmit()
- CourseObjectNode::optionsSubmit in includes/
CourseObjectNode.inc - Save object configs to cache.
1 method overrides CourseObject::optionsSubmit()
- CourseObjectNode::optionsSubmit in includes/
CourseObjectNode.inc - Save object configs to cache.
File
- includes/
CourseObject.inc, line 405
Class
- CourseObject
- Parent abstract base class of all course objects.
Code
public function optionsSubmit(&$form, &$form_state) {
ctools_include('plugins');
$uniqid = $this
->getId();
$nid = $this
->getCourseNid();
// Start editing session.
course_editing_start($this
->getCourse());
// Flip 'visible' so it behaves like 'hidden'.
if (isset($form_state['values']['hidden'])) {
$form_state['values']['hidden'] = $form_state['values']['hidden'] != 1;
}
// Object-specific settings
foreach (array_keys($this
->getOptions()) as $key) {
if (isset($form_state['values'][$key]) && !is_null($form_state['values'][$key])) {
$_SESSION['course'][$nid]['editing'][$uniqid][$key] = $form_state['values'][$key];
}
}
// Save plugin info.
if (isset($form_state['values']['plugins'])) {
foreach (ctools_get_plugins('course', 'course_object_access') as $key => $plugin) {
$_SESSION['course'][$nid]['editing'][$uniqid]['plugins']['access'][$key] = $form_state['values']['plugins']['access'][$key];
}
}
// Update the options.
$this
->setOptions($_SESSION['course'][$nid]['editing'][$uniqid]);
}