Jump to content

Get repeater id from a field


Matzn
 Share

Recommended Posts

Hi.

I need the repeater id by a field inside the repeater via api.

$repeater = $page->my_repeater;

foreach ($repeater as  $row) {
    if ($row->id == "repeater->myField->inside_the_repeater_row"){
		..someting
	}
}

For a selected field i need it, but a chikld from a other selected field. Maybe you have a better idea?

$wire->addHookAfter('InputfieldPage::getSelectablePages', function ($event) {
    if ($event->object->hasField == 'productOptionValue') {

        $page = $event->arguments('page');
        $options = $page->product_options;
        foreach ($options as $option) {
            if ($option->id == "285110") {
                $selector = 'parent=' . $option->product_option_key;
            }
        }
        $event->return = $event->pages->find($selector);
    }
});

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...