Jump to content

thei

Members
  • Posts

    5
  • Joined

  • Last visited

Profile Information

  • Gender
    Male
  • Location
    Germany

thei's Achievements

Newbie

Newbie (2/6)

2

Reputation

  1. Hi BitPoet, YES indeed it works. Thank you very much!! Nevertheless this case should be handled inside PW rather than checking for $page in the user defined hook. HM... what is the further procedure here. Should i report a bug? Where? Otherwise: the guideline here in this forum says, i should mark this as 'soved' by clicking the 'mark-as-solved' button. BUT there is no 'solved-button' displayed here 😞
  2. what is the procedure now? should i write a bug report? i guess here https://github.com/processwire/processwire-issues/issues ? Thank you for your help 🙂
  3. hm. if i download the latest stable i get a 3.0.227 (cannot find a 228) with 3.0.227 still the same behavior. OK found 229. same problem.
  4. but for a repeater field the page object is of class RepeaterPage. Using ->template returns 'repeater_....' which is not the name of the embedding page. The documentation of RepeaterPage describes a getForPage
  5. i 'm writing a hook for repeater labels $this->addHookAfter('InputfieldRepeater::renderRepeaterLabel', function(HookEvent $event) { // Get the object the event occurred on, if needed $InputfieldRepeater = $event->object; // An 'after' hook can retrieve and/or modify the return value $return = $event->return; // Get values of arguments sent to hook (if needed) $label = $event->arguments(0); $cnt = $event->arguments(1); $page = $event->arguments(2); // Your code here, perhaps modifying the return value // just a simple test: $return = "LABEL " . $page->getForPage()->template(); // Populate back return value, if you have modified it $event->return = $return; }); this hook function works (e.g. if i return a constant string) as long as i don't use '->getForPage()' the error message is '...... Page::getForPage does not exist or is not callable in this context' The hook is in 'ready.php'. it seems the events setting especially "$page" property is not complete within context? i want to set the repeater labels only if the parent of pages has a special template. (i m using Version 3.0.210) What i am doing wrong? Who can help? Thank You
×
×
  • Create New...