''); // Group option definition. $options['group'] = array( 'contains' => array( 'element_type' => array('default' => 'h3'), 'class' => array('default' => 'title'), ), ); // List option definition. $options['list'] = array( 'contains' => array( 'element_type' => array('default' => ''), 'class' => array('default' => ''), ), ); // Row option definition. $options['row'] = array( 'contains' => array( 'element_type' => array('default' => 'div'), 'class' => array('default' => ''), 'first_class' => array('default' => 'first'), 'last_class' => array('default' => 'last'), 'last_every_nth' => array('default' => '0'), 'striping_classes' => array('default' => 'odd even'), ), ); return $options; } /** * Render the given style. */ function options_form(&$form, &$form_state) { parent::options_form($form, $form_state); $form['id'] = array( '#type' => 'textfield', '#title' => t('View ID attribute'), '#default_value' => $this->options['id'], '#description' => 'This only works with views display plugins that use the default theme views-view.tpl.php. This includes the default, page, block, and attachment displays.', ); // Group options. $form['group'] = array( '#type' => 'fieldset', '#title' => 'Grouping title', '#description' => 'If using groups, the view will insert the grouping’s title field.', '#attributes' => array( 'class' => 'clear-block', ), ); $form['group']['element_type'] = array( '#prefix' => '
', '#suffix' => '
', '#title' => 'Element', '#type' => 'textfield', '#size' => '10', '#default_value' => $this->options['group']['element_type'], ); $form['group']['class'] = array( '#prefix' => '
', '#suffix' => '
', '#title' => 'Class attribute', '#type' => 'textfield', '#size' => '30', '#default_value' => $this->options['group']['class'], ); // List options. $form['list'] = array( '#type' => 'fieldset', '#title' => 'List', '#description' => t('If the output should be a HTML list, select the element and class attribute. The row element should also be set to %li.', array('%li' => 'li')), '#attributes' => array( 'class' => 'clear-block', ), ); $form['list']['element_type'] = array( '#prefix' => '
', '#suffix' => '
', '#type' => 'radios', '#title' => t('List type'), '#options' => array( '' => t('None'), 'ul' => t('Unordered list'), 'ol' => t('Ordered list'), 'dl' => t('Definition list'), ), '#default_value' => $this->options['list']['element_type'], ); $form['list']['class'] = array( '#prefix' => '
', '#suffix' => '
', '#title' => 'Class attribute', '#type' => 'textfield', '#size' => '30', '#default_value' => $this->options['list']['class'], ); // Row options. $form['row'] = array( '#type' => 'fieldset', '#title' => 'Row', '#attributes' => array( 'class' => 'clear-block', ), ); $form['row']['element_type'] = array( '#prefix' => '
', '#suffix' => '
', '#title' => 'Element', '#type' => 'textfield', '#size' => '10', '#default_value' => $this->options['row']['element_type'], ); $form['row']['class'] = array( '#prefix' => '
', '#suffix' => '
', '#title' => 'Class attribute', '#type' => 'textfield', '#size' => '30', '#default_value' => $this->options['row']['class'], '#description' => t('Insert a %hash where you want row enumeration.', array('%hash' => '#')), ); // First and last class options. $form['row']['first_last'] = array( '#type' => 'fieldset', '#title' => 'First and last classes', // The #parents attribute must be set to avoid another array layer around // the group of FIRST/LAST class attribute options. '#parents' => array('style_options', 'row'), '#description' => t('If the %last_every_nth option is empty or zero, the %first_class and %last_class are added once to only the first and last rows in the pager set. If this option is greater than 1, these classes are added to every nth row, which may be useful for grid layouts where the initial and final unit’s lateral margins must be 0.', array( '%last_every_nth' => 'FIRST/LAST every nth', '%first_class' => 'FIRST class attribute', '%last_class' => 'LAST class attribute', ) ), '#attributes' => array( 'class' => 'clear-block', ), ); $form['row']['first_last']['last_every_nth'] = array( '#prefix' => '
', '#suffix' => '
', '#type' => 'textfield', '#size' => '10', '#title' => t('FIRST/LAST every nth'), '#default_value' => $this->options['row']['last_every_nth'], ); $form['row']['first_last']['first_class'] = array( '#prefix' => '
', '#suffix' => '
', '#title' => 'FIRST class attribute', '#type' => 'textfield', '#size' => '30', '#default_value' => $this->options['row']['first_class'], ); $form['row']['first_last']['last_class'] = array( '#prefix' => '
', '#suffix' => '
', '#title' => 'LAST class attribute', '#type' => 'textfield', '#size' => '30', '#default_value' => $this->options['row']['last_class'], ); // Striping class options. $form['row']['striping_classes'] = array( '#title' => 'Striping class attributes', '#type' => 'textfield', '#size' => '30', '#default_value' => $this->options['row']['striping_classes'], '#description' => 'One striping class attribute is applied to each row. Separate multiple attributes with a space.', ); } /** * Validate the options form. */ function options_validate(&$form, &$form_state) { parent::options_validate($form, $form_state); // TODO: validate that the elements and classes are valid HTML. This is not // a substitute for output filtering. } }