The docs say:

 * @param $variables
 *   An associative array containing:
 *   - label_hidden: 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.

but 'content' is not respected.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joachim’s picture

Status: Active » Needs review
FileSize
588 bytes
claudiu.cristea’s picture

Issue summary: View changes

Yes, it's so weird that the properties content its actually prepared in theme layer. Shouldn't take place in the 'build' phase hook_entity_view() or EntityAPIControllerInterface::buildContent()? And then the theme engine should receive the already built content that it can alter in process/pre-process phase.

claudiu.cristea’s picture

Priority: Normal » Major
claudiu.cristea’s picture

Status: Needs review » Reviewed & tested by the community

Works nice for me. RTBC but still think that the property values must be prepared in the 'buildContent' phase. I opened a ticket for that in #2361465: Property values to be built in the 'build' phase (not in theme).

  • joachim authored 966c9cf on 7.x-1.x
    Issue #2109825 by joachim: theme_entity_property() doesn't respect '...
fago’s picture

Status: Reviewed & tested by the community » Fixed

Thanks - committed. I agree with #4 - but that seems to be a worthwhile fix meanwhile anyways.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

Jelle_S’s picture

FYI: This commit is not backwards compatible, this broke something on a production site of ours.

We had a preprocess function that ran before template_preprocess_entity_property and themed dates as formatted dates (instead of a timestamp) and stored it in $variables['content']. Took me a while before I found what was wrong. Now the preprocess function stores it in $element['#content']. I hope this helps others who might experience the same problem.