Update Page custom attribute value from a block
Permalink
Hello,
Can anyone help, I have been finding it hard to work out how to update a page attribute from a block.
Regards
Adam
Can anyone help, I have been finding it hard to work out how to update a page attribute from a block.
Regards
Adam
I am trying to update a custom page value through a block.
So the page will have one block which when updated will update the content on the page, then the outputted HTML will put into a HTML custom field which can then be used when using the page list block.
So the page will have one block which when updated will update the content on the page, then the outputted HTML will put into a HTML custom field which can then be used when using the page list block.
Hi,
I have the same issue. Did you figure out how to do it?
Thanks
I have the same issue. Did you figure out how to do it?
Thanks
Same Issue here. Tried it with just calling but semms thats not that easy.
Any hints?
Page::setAttribute('key', value);
Any hints?
Try this:
Page::getCurrentPage()->setAttribute('key', value);
Solved:
I think the important part is to get the Handle! The API implies you can use the handle direclty, but, in my case, it's not true.
public function save($data) { $p = Page::getCurrentPage(); if(is_object($p)) { $p->setAttribute(CollectionAttributeKey::getByHandle('handle'), $data['key']); } }
I think the important part is to get the Handle! The API implies you can use the handle direclty, but, in my case, it's not true.
What is the attribute you're trying to change?
-Jordan