webhoes Posted February 1, 2018 Share Posted February 1, 2018 Hello, I have a field tests on a page. These are checkboxes. I created the following code in ready.php to make them visible, but it doesn't work. It should show all tests that belong to the same customer ($page->parent->parent). I get the following error: Unknown Selector operator: '' -- was your selector value properly escaped? $wire->addHookAfter('InputfieldPage::getSelectablePages', function($event) { if($event->object->hasField == 'tests') { $currentPage = $event->arguments('page'); //current test page $rootParent = $currentPage->parent->parent; //project page // $rootParent = $currentPage->rootParent; $testParent = $rootParent->child('template=user-stories'); $tests = $testParent->children('template=user-story'); //all tests of that project $event->return = $event->pages->find($tests); } }); My page tree is like this: Home - Customer 1 (template customer) -- Tests (template tests) --- Test 1 (template test) --- Test 2 -- User stories (template user-stories) --- User story 1 (template user-story) --- user story 2 - Customer 2 -- Tests --- Test 1 -- User stories --- User stories 1 Link to comment Share on other sites More sharing options...
webhoes Posted February 1, 2018 Author Share Posted February 1, 2018 Got it! $wire->addHookAfter('InputfieldPage::getSelectablePages', function($event) { if($event->object->hasField == 'tests') { $currentPage = $event->arguments('page'); //current test page $rootParent = $currentPage->parent->parent; //project page // $rootParent = $currentPage->rootParent; $testParent = $rootParent->child('template=user-stories'); $tests = $testParent->children('template=user-story'); //all tests of that project $event->return = $event->pages->find("id=$tests"); } }); Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now