1 | <?php |
---|
2 | /** |
---|
3 | * @file |
---|
4 | * Contains the base row style plugin. |
---|
5 | */ |
---|
6 | |
---|
7 | /** |
---|
8 | * The basic 'fields' row plugin |
---|
9 | * |
---|
10 | * This displays fields one after another, giving options for inline |
---|
11 | * or not. |
---|
12 | * |
---|
13 | * @ingroup views_row_plugins |
---|
14 | */ |
---|
15 | class views_semantic_plugin_row_semanticrows.inc extends views_plugin_row { |
---|
16 | function option_definition() { |
---|
17 | $options = parent::option_definition(); |
---|
18 | $options['title_field'] = array('default' => ''); |
---|
19 | $options['content_field'] = array('default' => ''); |
---|
20 | $options['description_field'] = array('default' => ''); |
---|
21 | return $options; |
---|
22 | } |
---|
23 | |
---|
24 | function options_form(&$form, &$form_state) { |
---|
25 | parent::options_form($form, $form_state); |
---|
26 | |
---|
27 | // Pre-build all of our option lists for the dials and switches that follow. |
---|
28 | $fields = array('' => t('<none>')); |
---|
29 | foreach ($this->display->handler->get_handlers('field') as $field => $handler) { |
---|
30 | if ($label = $handler->label()) { |
---|
31 | $fields[$field] = $label . ' ' . $handler->options['format']; |
---|
32 | } |
---|
33 | else { |
---|
34 | $fields[$field] = $handler->ui_name(); |
---|
35 | } |
---|
36 | } |
---|
37 | $form['title_field'] = array( |
---|
38 | '#type' => 'select', |
---|
39 | '#title' => t('Title field'), |
---|
40 | '#options' => $fields, |
---|
41 | '#default_value' => $this->options['title_field'], |
---|
42 | '#description' => t('Select the field that will be used as the title field.'), |
---|
43 | ); |
---|
44 | $form['content_field'] = array( |
---|
45 | '#type' => 'select', |
---|
46 | '#title' => t('Content field'), |
---|
47 | '#options' => $fields, |
---|
48 | '#default_value' => $this->options['content_field'], |
---|
49 | '#description' => t('Select the field that will be used as the content.'), |
---|
50 | ); |
---|
51 | |
---|
52 | $form['description_field'] = array( |
---|
53 | '#type' => 'select', |
---|
54 | '#title' => t('Description field'), |
---|
55 | '#options' => $fields, |
---|
56 | '#default_value' => $this->options['description_field'], |
---|
57 | '#description' => t('Select the field that will be used as the description.'), |
---|
58 | ); |
---|
59 | |
---|
60 | } |
---|
61 | } |
---|