You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The example uses the wrong method for the intended purpose.
$pages->edit()
The correct method is
$pages->setField()
#My example
<?php
class TitleAppender extends Plugin {
public function afterPageModify($key)
{
$page = new Page($key);
$Custom = $page->getValue('custom');
$Type = array('Type'=>array());
array_push($Custom, $Type);
global $pages;
$pages->setField($key,'custom', $Custom);
}
}
?>
I want to add a note, Bludit never ceases to amaze me, how simple and powerful.
These functionalities (afterPageCreate and afterPageModify) are very powerful for creating content type plugins. And it's worth it to get it working properly. If it messes up the user's possible customFields, it won't be very reliable.
The potential is enormous, because it allows you to create almost any project (e-learning, ecommerce....) with little code, extending Pages as contenTypes, an extended class of Pages which will conveniently filter the content before output..
For a simple frontend output just replace the global $Pages with $Pages= new customTypes() ;
The text was updated successfully, but these errors were encountered:
Describe your problem
When I use the example function with customFields enabled, the customFields information is not saved and is deleted.
Steps to reproduce the problem
Using the example plugin with valid customFields
https://docs.bludit.com/en/plugins/pages-after-creation
Bludit version
3.14.1.
Hosting or Webserver name
x10hosting
PHP version
PHP version: 7.4.16
SOLUTION
The example uses the wrong method for the intended purpose.
$pages->edit()
The correct method is
$pages->setField()
#My example
I want to add a note, Bludit never ceases to amaze me, how simple and powerful.
These functionalities (afterPageCreate and afterPageModify) are very powerful for creating content type plugins. And it's worth it to get it working properly. If it messes up the user's possible customFields, it won't be very reliable.
The potential is enormous, because it allows you to create almost any project (e-learning, ecommerce....) with little code, extending Pages as contenTypes, an extended class of Pages which will conveniently filter the content before output..
For a simple frontend output just replace the global $Pages with $Pages= new customTypes() ;
The text was updated successfully, but these errors were encountered: