function theme_entity_property in Entity API 7
Returns HTML for an entity property.
This is the default theme implementation to display the value of a property. This function can be overridden with varying levels of specificity. For example, for a property named 'title' displayed on the 'article' bundle, any of the following functions will override this default implementation. The first of these functions that exists is used:
- THEMENAME_property__body__article()
- THEMENAME_property__article()
- THEMENAME_property__body()
- THEMENAME_property()
Parameters
$variables: An associative array containing:
- label: A boolean indicating to show or hide the property label.
- title_attributes: A string containing the attributes for the title.
- label: The label for the property.
- content_attributes: A string containing the attributes for the content's div.
- content: The rendered property value.
- attributes: A string containing the attributes for the wrapping div.
1 theme call to theme_entity_property()
- EntityAPIController::renderEntityProperty in includes/
entity.controller.inc - Renders a single entity property.
File
- theme/
entity.theme.inc, line 33 - Holds entity module's theme functions.
Code
function theme_entity_property($variables) {
$output = '';
// Render the label, if it's not hidden.
if (!$variables['label_hidden']) {
$output .= '<div' . $variables['title_attributes'] . '>' . $variables['label'] . ': </div>';
}
// Render the content.
$content_suffix = '';
if (!$variables['label_hidden'] || $variables['content_attributes']) {
$output .= '<div' . $variables['content_attributes'] . '>';
$content_suffix = '</div>';
}
$output .= $variables['content'] . $content_suffix;
// Render the top-level DIV.
return '<div' . $variables['attributes'] . '>' . $output . '</div>';
}