You are here

function content_handler_field::element_type in Content Construction Kit (CCK) 6.3

Same name and namespace in other branches
  1. 6.2 includes/views/handlers/content_handler_field.inc \content_handler_field::element_type()

Return DIV or SPAN based upon the field's element type.

1 call to content_handler_field::element_type()
content_handler_field_multiple::element_type in includes/views/handlers/content_handler_field_multiple.inc
Return DIV or SPAN based upon the field's element type.
1 method overrides content_handler_field::element_type()
content_handler_field_multiple::element_type in includes/views/handlers/content_handler_field_multiple.inc
Return DIV or SPAN based upon the field's element type.

File

includes/views/handlers/content_handler_field.inc, line 139
The subclass adds basic field and formatter info, for field-specific subclasses to use if they need to.

Class

content_handler_field
@file The subclass adds basic field and formatter info, for field-specific subclasses to use if they need to.

Code

function element_type($none_supported = FALSE, $default_empty = FALSE) {

  // The 'element_type' property denotes Views 3.x ('semantic views'
  // functionnality). If the property is set, and not set to '' ("default"),
  // let the generic method handle the output.
  if (isset($this->options['element_type']) && $this->options['element_type'] !== '') {
    return parent::element_type($none_supported, $default_empty);
  }
  if ($default_empty) {
    return '';
  }
  if (isset($this->definition['element type'])) {
    return $this->definition['element type'];
  }

  // TODO Figure out exactly when to return a div or a <span>. Any field
  // that ever needs to be shown inline in Views UI. It needs to return
  // a div for textareas to prevent wrapping a <span> around a <p>.
  // Earl says we need to be sure that other fields we don't know
  // about won't end up wrapping a span around a block-level element.
  if ($this->content_field['widget']['type'] == 'text_textarea') {
    return 'div';
  }
  else {
    return 'span';
  }
}