Preface: Do not use that method from that blog, there is a better method.
something._referringItem
is not cache safe, so better not use this inside Twig templates.
something._referringItem
doesn't perform any access checks
paragraph._referringItem.parent.parent.entity
is possibly the longest and most confusing alternative to write paragraph.parentEntity
So, now the real answer :-)
paragraph.parentEntity
is returning the raw parent entity object (very similar to the paragraph
variable) but it does not include a render array like content
. So you neither need .content
nore you need |field_value
.
Instead head directly for the field value parent.field_on_hostnode.0.value
More info about variables in entity templates:
content
= complete render array of an entity
content.field_something
= render array of a single field
content.field_something|field_value
= get raw field value back from a render array (requires "Twig field value" module)
entity
= raw entity object (replace entity with node
in node template, paragraph
in paragraph template, etc).
entity.field_something.value
= not recommended, will behave differently depending on field type and field cardinality
entity.field_something.getValue()
= get an array of raw field values, works for all field types and all field cardinalities
entity.field_something.0.value
= get the first raw data field value (for plaintext fields, numbers, emails, telephone field; will not work with links, images, entity references...)
entity.field_something.0.name_of_database_column
= get the first raw data subvalue name_of_database_column
of field_something (this could be format
in a formatted text field, end_value
in a daterange field, target_id
in a entity reference field,...)
Entity reference field only:
Note that the following methods are not cache-safe, not language-aware and do not perform access checks.
entity.field_reference.0.target_id
= get the numeric ID of the first referenced child entity
entity.field_reference.0.entity
= the first referenced child entity object (no render array!)
entity.field_reference.0.entity.getTranslation('de')
= get the german translation of the first child object
Paragraphs only:
paragraph.parentEntity
= the direct parent entity object (no render array!)