Skip to content
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

OEL-2251: Use heading in featured-media pattern. #307

Merged
merged 4 commits into from
Mar 10, 2023
Merged

OEL-2251: Use heading in featured-media pattern. #307

merged 4 commits into from
Mar 10, 2023

Conversation

tibi2303
Copy link
Contributor

@tibi2303 tibi2303 commented Mar 2, 2023

Jira issue(s):

{% include '@oe-bcl/heading' with {
title: title,
title_tag: title_tag|default('h2'),
title_link: title_link|default(''),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here we have the choice between an undefined variable and an empty string, does it make sense to set it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the default on title_link.

@tibi2303 tibi2303 force-pushed the OEL-2251 branch 2 times, most recently from e3d93a2 to 525760a Compare March 7, 2023 15:20
label: 'Title tag'
description: 'The tag to use for the title. Defaults to h2.'
title_link:
type: LinkObject
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type must be a php type, like string, array, or an object of a certain class name, this is neither. Let's use string and set whatever format the heading in the template. Then also name it correspondingly, perhaps title_url ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed. I also added tests and changed the pattern of gallery. Please have a look. I guess we either change the ticket and title of this PR or we make the gallery changes in another ticket.

{% include '@oe-bcl/heading' with {
title: title,
title_tag: title_tag|default('h2'),
title_link: title_link,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with my previous comment I meant that the entire line can dissapear, but since you added it to the yml, and I dont see why not, then you can add the default back

Copy link
Contributor Author

@tibi2303 tibi2303 Mar 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should not only be the default as this param is expecting a BCL link object. I added the check if it's exists and merging it accordingly. Also did this for gallery.

title: title,
title_tag: title_tag|default('h2'),
title_link: title_link,
attributes: create_attribute({'class': 'mb-4'}).merge(title.attributes|default(create_attribute())),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

title.attributes is still nok, because title is marked as a string in the yml, and we should keep it that way.. we want to move away from these objects because they cause complications in the drupal layer that limit our solutions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should be cleaned now. Only creating the attribute and adding the class.

@tibi2303 tibi2303 force-pushed the OEL-2251 branch 2 times, most recently from 3e47333 to d728388 Compare March 8, 2023 11:51
@@ -12,6 +12,12 @@
{% set items = bcl_gallery_items(items|default([])) %}
{% set icon_path = bcl_icon_path %}

{%- if title_url is not empty -%}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think its a misunderstanding, let's rather remove all these new fields to prevent opening a pandoras box of heading fields. And later if they are needed it will be a separate ticket handing them all

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@drishu drishu changed the title OEL-2251: Changed title of featured-media pattern. OEL-2251: Use heading in of featured-media pattern. Mar 10, 2023
@drishu drishu changed the title OEL-2251: Use heading in of featured-media pattern. OEL-2251: Use heading in featured-media pattern. Mar 10, 2023
@drishu drishu merged commit b445f89 into 1.x Mar 10, 2023
@drishu drishu deleted the OEL-2251 branch March 10, 2023 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Only display heading for title in the pattern featured media if it is not empty
2 participants