Creating values for site attributes/keys
Permalink
Hi,
During the installation of my package I create a few Sets in the 'site' category in those sets I create some attributes (SiteKey) so people can edit some basic settings in their website (stuff like company logo, company name).
I've also created a dashboard page where the site admin can edit the attributes/settings I created. I run in to some problems when I try to save values to these attributes.
I've been through all classes under src/Attribute and src/Entity/Attribute but I can't seem to find a method for creating/saving the value. There are some deprecated methods in Concrete\Core\Attribute\Controller but they don't seem to work anymore and just return null.
For example:
Does anyone know how values should be saved in the framework?
During the installation of my package I create a few Sets in the 'site' category in those sets I create some attributes (SiteKey) so people can edit some basic settings in their website (stuff like company logo, company name).
$key = array( 'akName' => t($name), 'akHandle' => $handle, ); $key = SiteKey::add($attribute_type,$key,$pkg); $manager = new StandardSetManager($category,Database::get()->getEntityManager()); $manager->addKey($set,$key);
I've also created a dashboard page where the site admin can edit the attributes/settings I created. I run in to some problems when I try to save values to these attributes.
I've been through all classes under src/Attribute and src/Entity/Attribute but I can't seem to find a method for creating/saving the value. There are some deprecated methods in Concrete\Core\Attribute\Controller but they don't seem to work anymore and just return null.
For example:
foreach ($data as $key => $value){ $ko = $r->findOneBy( array('akHandle' => $key) ); $kc = $ko->getController(); $kc->createAttributeValue($value); }
Does anyone know how values should be saved in the framework?
Have you checked the most recent documentation on attributes? There have been quite a few changes.
https://documentation.concrete5.org/developers/appendix/recently-add...