You are here

function activity_comments_handler_field_comments::options_form in Activity 7

Same name and namespace in other branches
  1. 6.2 activity_comments/views/activity_comments_handler_field_comments.inc \activity_comments_handler_field_comments::options_form()

Default options form provides the label widget that all fields should have.

Overrides views_handler_field::options_form

File

activity_comments/views/activity_comments.views.inc, line 113

Class

activity_comments_handler_field_comments
Activity comments comment form field handler.

Code

function options_form(&$form, &$form_state) {
  parent::options_form($form, $form_state);
  $form['order'] = array(
    '#type' => 'select',
    '#title' => t('Order comments by'),
    '#default_value' => $this->options['order'],
    '#options' => array(
      'ASC' => t('Created time - ascending'),
      'DESC' => t('Created time - descending'),
    ),
  );
  $form['limit'] = array(
    '#type' => 'textfield',
    '#title' => t('Comments number limit'),
    '#size' => 5,
    '#default_value' => $this->options['limit'],
  );
  $results = db_query("SELECT aid, label FROM {actions} WHERE type = 'activity'")
    ->fetchAllAssoc('aid');
  foreach ($results as $actions_id => $row) {
    $options[$actions_id] = check_plain($row->label);
  }
  $form['templates'] = array(
    '#title' => t('Templates'),
    '#type' => 'checkboxes',
    '#options' => $options,
    '#description' => t('Select the templates that users can comment on'),
    '#default_value' => $this->options['templates'],
    '#required' => TRUE,
  );
}