| Commit | Line | Data |
|---|---|---|
| fe44beb7 | 1 | <?php |
| fe44beb7 EM |
2 | /** |
| 3 | * @file | |
| 4 | * Contains the grid style plugin. | |
| 5 | */ | |
| 6 | ||
| 7 | /** | |
| 8 | * Style plugin to render each item in a grid cell. | |
| 9 | * | |
| 10 | * @ingroup views_style_plugins | |
| 11 | */ | |
| 12 | class views_plugin_style_grid extends views_plugin_style { | |
| 13 | /** | |
| 14 | * Set default options | |
| 15 | */ | |
| 16 | function option_definition() { | |
| 17 | $options = parent::option_definition(); | |
| 18 | ||
| 19 | $options['columns'] = array('default' => '4'); | |
| 20 | $options['alignment'] = array('default' => 'horizontal'); | |
| 21 | ||
| 22 | return $options; | |
| 23 | } | |
| 24 | ||
| 25 | /** | |
| 26 | * Render the given style. | |
| 27 | */ | |
| 28 | function options_form(&$form, &$form_state) { | |
| 29 | parent::options_form($form, $form_state); | |
| 30 | $form['columns'] = array( | |
| 31 | '#type' => 'textfield', | |
| 32 | '#title' => t('Number of columns'), | |
| 33 | '#default_value' => $this->options['columns'], | |
| 34 | ); | |
| 35 | $form['alignment'] = array( | |
| 36 | '#type' => 'radios', | |
| 37 | '#title' => t('Alignment'), | |
| 38 | '#options' => array('horizontal' => t('Horizontal'), 'vertical' => t('Vertical')), | |
| 39 | '#default_value' => $this->options['alignment'], | |
| 40 | '#description' => t('Horizontal alignment will place items starting in the upper left and moving right. Vertical alignment will place items starting in the upper left and moving down.'), | |
| 41 | ); | |
| 42 | } | |
| 43 | } | |
| 44 |