When we have following field structure like given below

Node
|- Paragraph field
|-- Paragraph field
|--- Some field like link etc.

Where, one paragraph embedded into another and display is patternbuilder formatter display at that time, if we want to alter some field of inner paragraph, we can't hook into entity view, because inner field is referenced by entity reference and assembled by paragraph.

So there is no way to hook into field.
Propose solution will create one hook and allow to hook into entity and modify fields accordingly.

Comments

mohit_aghera created an issue. See original summary.

mohit_aghera’s picture

mohit_aghera’s picture

Issue summary: View changes
mohit_aghera’s picture

StatusFileSize
new1.77 KB

Updating initial patch.

mohit_aghera’s picture

Status: Active » Needs review
hussainweb’s picture

Version: 7.x-1.1 » 7.x-1.x-dev
Status: Needs review » Needs work
+++ b/profile/modules/patternbuilder/patternbuilder.api.php
@@ -139,3 +139,17 @@ function hook_patternbuilder_pattern_status_info() {
+function hook_patternbuilder_entity_prepare($entity, $context) {

Shouldn't this be hook_patternbuilder_entity_prepare_alter?

mohit_aghera’s picture

Status: Needs work » Needs review
StatusFileSize
new1.54 KB

Thank you @hussainweb for quick review and all the support.

mohit_aghera’s picture

StatusFileSize
new1.54 KB

Fixing code formatting issue.

hussainweb’s picture

I don't think this is a blocker but the comments could be improved. Also, the invocation of drupal_alter could use a comment to explain the intention of firing a alter hook briefly.

mohit_aghera’s picture

hussainweb’s picture

While we go ahead with this, to me, it seems like a quick fix. It would be quite valuable to figure out a built-in Drupal hook when rendering fields as property maps as well.

siwinski’s picture

siwinski’s picture