diff --git handlers/views_handler_field.inc handlers/views_handler_field.inc index 6d01f73..66070ff 100644 --- handlers/views_handler_field.inc +++ handlers/views_handler_field.inc @@ -17,6 +17,7 @@ * 'field' => fieldname); as many fields as are necessary * may be in this array. * - click sortable: If TRUE, this field may be click sorted. + * - no semantic: If TRUE, it disables the semantic output. */ class views_handler_field extends views_handler { var $field_alias = 'unknown'; @@ -136,12 +137,24 @@ class views_handler_field extends views_handler { * Return DIV or SPAN based upon the field's element type. */ function element_type() { + if ($this->options['element type']) { + return $this->options['element type']; + } if (isset($this->definition['element type'])) { return $this->definition['element type']; } return 'span'; } + + /** + * Return the class of the field. + */ + function classes() { + if ($this->options['class']) { + return $this->options['class']; + } + } function option_definition() { $options = parent::option_definition(); @@ -167,6 +180,8 @@ class views_handler_field extends views_handler { 'html' => array('default' => FALSE), ), ); + $options['class'] = array('default' => ''); + $options['element type'] = array('default' => ''); $options['empty'] = array('default' => '', 'translatable' => TRUE); $options['hide_empty'] = array('default' => FALSE); $options['empty_zero'] = array('default' => FALSE); @@ -193,6 +208,22 @@ class views_handler_field extends views_handler { '#default_value' => $this->options['exclude'], '#description' => t('Check this box to not display this field, but still load it in the view. Use this option to not show a grouping field in each record, or when doing advanced theming.'), ); + $form['element type'] = array( + '#prefix' => '
', + '#suffix' => '
', + '#title' => t('Element'), + '#type' => 'textfield', + '#size' => '10', + '#default_value' => $this->options['element type'], + ); + $form['class'] = array( + '#prefix' => '
', + '#suffix' => '
', + '#title' => t('Class attribute'), + '#type' => 'textfield', + '#size' => '30', + '#default_value' => $this->options['class'], + ); if ($this->allow_advanced_render()) { $form['alter']['#tree'] = TRUE; diff --git theme/theme.inc theme/theme.inc index 2f951e6..ec864e6 100644 --- theme/theme.inc +++ theme/theme.inc @@ -186,6 +186,7 @@ function template_preprocess_views_view_fields(&$vars) { $object->element_type = $object->handler->element_type(); $object->class = views_css_safe($id); + $object->classes = $object->handler->classes(); $object->label = check_plain($view->field[$id]->label()); $vars['fields'][$id] = $object; } diff --git theme/views-view-fields.tpl.php theme/views-view-fields.tpl.php index bfab537..e93cd97 100644 --- theme/views-view-fields.tpl.php +++ theme/views-view-fields.tpl.php @@ -34,6 +34,6 @@ // $field->element_type is either SPAN or DIV depending upon whether or not // the field is a 'block' element type or 'inline' element type. ?> - <element_type; ?> class="field-content">content; ?>element_type; ?>> + <element_type; ?> class="field-content classes;?>">content; ?>element_type; ?>> inline_html;?>>