You are here

function CourseObjectBook::optionsForm in Course 7

Same name and namespace in other branches
  1. 6 modules/course_book/course_book.classes.inc \CourseObjectBook::optionsForm()
  2. 7.2 modules/course_book/course_book.classes.inc \CourseObjectBook::optionsForm()

Default options form for all course objects.

Overrides CourseObjectNode::optionsForm

File

modules/course_book/course_book.classes.inc, line 42

Class

CourseObjectBook

Code

function optionsForm(&$form, &$form_state) {
  $config = $this
    ->getOptions();
  parent::optionsForm($form, $form_state);
  $form['book_tracking'] = array(
    '#title' => t('Completion criteria'),
    '#type' => 'select',
    '#options' => array(
      'one' => t('View any page'),
      'all' => t('View all pages'),
    ),
    '#default_value' => $config['book_tracking'],
  );

  // Add a book-specific configuration for course outline list item type, only
  // if the standard course list outline handler is selected.
  if ($this
    ->getCourse()
    ->getNode()->course['outline'] == 'course') {
    $form['outline_list_item_type'] = array(
      '#title' => t('Course outline list item type'),
      '#type' => 'select',
      '#options' => array(
        'all_pages' => t('All book pages as an expanded, nested list'),
        'active_tree' => t('Only the active book menu tree items, with a count indicator'),
        'count' => t('A count indicator only'),
      ),
      '#default_value' => $config['outline_list_item_type'],
    );
  }
  if (!module_exists('node_access_book')) {
    $form['node']['private']['#description'] .= '<br/><span style="color: #d00">If using "private", you should install <a href="http://drupal.org/project/node_access_book">Node access book</a> to ensure that book sub-pages obey the content access on the book parent.';
  }
}