Skip to content

RepeaterPage->getForField() throws warning if not Superuser and a lister is configured to show repeater templates #2151

@jlahijani

Description

@jlahijani

Do the following to replicate this warning:

  • create a lister (can be listerpro) and under "What pages should a repeater show?" make it be a repeater_... template (create a repeater field if you don't have one already so you can select it here).
  • log in as a non-superuser and view the lister that was just created

You will get this warning:

Warning: Attempt to read property "name" on null in [.../modules/Fieldtype/FieldtypeRepeater/RepeaterPage.php:116]

I investigated it a bit and it's referring to this line in the getForField() method:

$grandparentName = $grandparent->name;

$grandparent is null. The ID of $this within that method is "999". 999 is not a real page; it's the test page that is used in the validateSelector method:

$testPage->id = 999; // required (any ID number works)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions