-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EWPP-287: Create organisation teaser #595
Conversation
@@ -0,0 +1,61 @@ | |||
langcode: en |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The approach looks good to me, I like the adjacent fixes, just 2 small copy paste errors found.
use Drupal\user\Entity\User; | ||
|
||
/** | ||
* Tests the project rendering. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Organisation rendering
} | ||
|
||
/** | ||
* Test a project being rendered as a teaser. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test a organisation being..
{{ pattern('list_item', { | ||
'variant': 'thumbnail_secondary', | ||
'url': url, | ||
'meta': content.oe_organisation_acronym|field_value, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
meta should accept an array, change it into:
'meta': [
content.oe_organisation_acronym|field_value,
]
'additional_information': [ | ||
content.extra_field_oe_theme_content_organisation_teaser_details, | ||
], | ||
'image': image_url ? { 'src': image_url } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we not pass the alt value of the image here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are not doing that anywhere actually, as the image is displayed as a background anyway and we want to refactor that into using media container. I'd postpone this to this follow up: EWPP-249 which has already some POC work done here #569
use Symfony\Component\DependencyInjection\ContainerInterface; | ||
|
||
/** | ||
* Display contact information. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Display contact information. | |
* Display organisation details. |
return $build; | ||
} | ||
|
||
$cache->addCacheableDependency($contact); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's maybe move this before line 89? Changes on the entity might have a consequence on its access.
protected function getRenderableFieldListItem(ContentEntityInterface $entity, string $field_name, array $display_options = []): array { | ||
if ($entity->get($field_name)->isEmpty()) { | ||
return []; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move this if before 109, so we only check for the empty field and we don't have to check for if (!empty($item)) {
. It will be the responsibility of the called to call this function knowing that it will return.
modules/oe_theme_content_organisation/src/Plugin/ExtraField/Display/TeaserDetailsExtraField.php
Show resolved
Hide resolved
} | ||
|
||
/** | ||
* Gets renderable item for field list pattern. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* Gets renderable item for field list pattern. | |
* Get renderable item for field list pattern. |
EWPP-287
Teaser for Organisation node.