additional_fields['aid'] = array('table' => 'activity', 'field' => 'aid'); } function query() { $this->add_additional_fields(); } function render($values) { return drupal_get_form('activity_comments_form', $values->{$this->aliases['aid']}, $this->options['limit'], $this->options['order']); } function option_definition() { $options = parent::option_definition(); $options['order'] = array( 'default' => 'ASC', 'translatable' => FALSE, ); $options['limit'] = array( 'default' => '2', 'translatable' => FALSE, ); return $options; } 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' => isset($this->options['limit']) ? $this->options['limit'] : 2, ); } }