Skip to main content
added 56 characters in body
Source Link
Matt
  • 373
  • 1
  • 14

I'm using the Stock Photo Search module, for particular image fields, and it has its own field type with interesting properties.

As far as I can tell, the only way to access the URI of the image is content.field_stock_photo[0]['#uri']. There is no node.field_stock_photo.0.entity.uri.value or similar. The only way to access the URI is through the rendered entity.

The problem I'm running into is when using a reference to another node that has the stock_photo_search field, I have no way to access this rendered entity from a reference. node.reference.0.entity.field_stock_photo.value doesn't do it, and as far as I can tell node.reference.0.content.field_stock_photo doesn't work.

How do I go about getting properties from a rendered entity of a reference in Twig?

I'm using the Stock Photo Search module, for particular image fields, and it has its own field type with interesting properties.

As far as I can tell, the only way to access the URI of the image is content.field_stock_photo[0]['#uri']. There is no node.field_stock_photo.0.entity.uri.value or similar. The only way to access the URI is through the rendered entity.

The problem I'm running into is when using a reference, I have no way to access this rendered entity from a reference. node.reference.0.entity.field_stock_photo.value doesn't do it, and as far as I can tell node.reference.0.content.field_stock_photo doesn't work.

How do I go about getting properties from a rendered entity of a reference in Twig?

I'm using the Stock Photo Search module, for particular image fields, and it has its own field type with interesting properties.

As far as I can tell, the only way to access the URI of the image is content.field_stock_photo[0]['#uri']. There is no node.field_stock_photo.0.entity.uri.value or similar. The only way to access the URI is through the rendered entity.

The problem I'm running into is when using a reference to another node that has the stock_photo_search field, I have no way to access this rendered entity from a reference. node.reference.0.entity.field_stock_photo.value doesn't do it, and as far as I can tell node.reference.0.content.field_stock_photo doesn't work.

How do I go about getting properties from a rendered entity of a reference in Twig?

Highlighted code
Source Link
leymannx
  • 18.8k
  • 6
  • 72
  • 126

How to get rendered content properties from an entity reference in twig?Twig

I'm using the Stock Photo SearchStock Photo Search module, for particular image fields, and it has its'its own field type with interesting properties.

AFAICTAs far as I can tell, the only way to access the uriURI of the image is content.field_stock_photo[0]['#uri']content.field_stock_photo[0]['#uri']. ThereThere is no node.field_stock_photo.0.entity.uri.valuenode.field_stock_photo.0.entity.uri.value or similar. TheThe only way to access the URI is through the rendered entity.

The problem I'm running into is when using a reference, I have no way to access this rendered entity from a reference. node.reference.0.entity.field_stock_photo.value node.reference.0.entity.field_stock_photo.value doesn't do it, and as far as I can tell node.reference.0.content.field_stock_photonode.reference.0.content.field_stock_photo doesn't work.

How do I go about getting properties from a rendered entity of a reference in twigTwig?

How to get rendered content properties from an entity reference in twig?

I'm using the Stock Photo Search module, for particular image fields, and it has its' own field type with interesting properties.

AFAICT, the only way to access the uri of the image is content.field_stock_photo[0]['#uri']. There is no node.field_stock_photo.0.entity.uri.value or similar. The only way to access the URI is through the rendered entity.

The problem I'm running into is when using a reference, I have no way to access this rendered entity from a reference. node.reference.0.entity.field_stock_photo.value doesn't do it, and as far as I can tell node.reference.0.content.field_stock_photo doesn't work.

How do I go about getting properties from a rendered entity of a reference in twig?

How to get rendered content properties from an entity reference in Twig

I'm using the Stock Photo Search module, for particular image fields, and it has its own field type with interesting properties.

As far as I can tell, the only way to access the URI of the image is content.field_stock_photo[0]['#uri']. There is no node.field_stock_photo.0.entity.uri.value or similar. The only way to access the URI is through the rendered entity.

The problem I'm running into is when using a reference, I have no way to access this rendered entity from a reference. node.reference.0.entity.field_stock_photo.value doesn't do it, and as far as I can tell node.reference.0.content.field_stock_photo doesn't work.

How do I go about getting properties from a rendered entity of a reference in Twig?

Source Link
Matt
  • 373
  • 1
  • 14

How to get rendered content properties from an entity reference in twig?

I'm using the Stock Photo Search module, for particular image fields, and it has its' own field type with interesting properties.

AFAICT, the only way to access the uri of the image is content.field_stock_photo[0]['#uri']. There is no node.field_stock_photo.0.entity.uri.value or similar. The only way to access the URI is through the rendered entity.

The problem I'm running into is when using a reference, I have no way to access this rendered entity from a reference. node.reference.0.entity.field_stock_photo.value doesn't do it, and as far as I can tell node.reference.0.content.field_stock_photo doesn't work.

How do I go about getting properties from a rendered entity of a reference in twig?