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

add array key to prismic block #108

Merged
merged 2 commits into from
Nov 20, 2023

Conversation

IvoElgentos
Copy link
Contributor

No description provided.

Copy link
Contributor

@WouterSteen WouterSteen left a comment

Choose a reason for hiding this comment

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

Is the change in block/Slice.php really needed? b/c seems like we dont do anything with it in that function?

Copy link
Contributor

@JeroenBoersma JeroenBoersma left a comment

Choose a reason for hiding this comment

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

Thank you!

Nice submission, added a suggestion but looks good to me

Block/Slices.php Outdated
@@ -6,7 +6,7 @@

class Slices extends Group
{
public function fetchItem(\stdClass $slice): string
public function fetchItem(\stdClass $slice, $key): string
Copy link
Contributor

Choose a reason for hiding this comment

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

:suggestion (non-blocking): you could add the setIterator($key) here too on the block after setDocument

@JeroenBoersma
Copy link
Contributor

Is the change in block/Slice.php really needed? b/c seems like we dont do anything with it in that function?

yes, thought I could imagine that need to set a default for the field for backwards compatibility.

$key = null; to make sure that extension will not break.

effective

function fetchItem(..., $key = null)
//...
null !== $key && $block->setIterator($key)

@JeroenBoersma
Copy link
Contributor

Is the change in block/Slice.php really needed? b/c seems like we dont do anything with it in that function?

Yes because it overwrites the Grouped and those need to be compatible...

Can you review Wouter? Than we can merge this and tag it as a minor update 🍻

@WouterSteen WouterSteen merged commit 0827e46 into elgentos:main Nov 20, 2023
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.

3 participants