class activity_comments_handler_field_comments in Activity 6.2
Same name and namespace in other branches
- 7 activity_comments/views/activity_comments.views.inc \activity_comments_handler_field_comments
Activity comments comment form field handler.
Hierarchy
- class \activity_comments_handler_field_comments extends \views_handler_field
Expanded class hierarchy of activity_comments_handler_field_comments
1 string reference to 'activity_comments_handler_field_comments'
- activity_comments_views_data in activity_comments/
views/ activity_comments.views.inc - Implementation of hook_views_data().
File
- activity_comments/
views/ activity_comments_handler_field_comments.inc, line 6
View source
class activity_comments_handler_field_comments extends views_handler_field {
function init(&$view, $options) {
parent::init($view, $options);
$this->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,
);
}
}