Sebastian Posted 17 hours ago Posted 17 hours ago Hello dear forum, I'm building the backend of a kind of magazine. The magazine has different contributors. Each contributor has it's own tree in the page tree, like this: home/user-articles/contributor-a/ and should be able to post articles as children to contributor-a. On the contributor-a page (template called "article-list") there needs to be a list of dates. These dates (a repeater in "article list") are used as select options in the article the user is going to post. So far so good. However, if the user tries to create a new article, and there haven't been any dates posted to the future parent yet, I get an error : "TypeError ProcessWire\InputfieldPage::getPageLabel(): Argument #1 ($page) must be of type ProcessWire\Page, string given, called in /var/www/html/wire/modules/Inputfield/InputfieldPage/InputfieldPage.module on line 700" wich only occurs when there's no date(s) posted to the parent yet. Now I'm thinking about only allowing adding new children to that "article-list" template when at least one date is available, and am stumped as to how to solve this. I basically need to disable the "new" button in the tree view - or basically anwhere it might show up - and post a message explaining what's up. Pretty sure I need to hook into ready.php (or admin.php) but other than that I'm struggling.. If anyone has any pointers (or just some skeleton code) that would be great, thanks in advance!
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