Hi @Vitaliy and all further members,
I got a further question regarding this topic. I have successfully saved the schema and stored my data in the database. But after submitting, the data I stored before is no longer available in the database. So not only the setting_value but also setting_name etc. is not available anymore. My schema extension was practically undone.
I would like to access my saved data in the article view similar to here, but unfortunately my saved elements are no longer available. I can already retrieve other initially existing elements. It happens at the moment during the workflow, when I assign the submission to an issue.
How can I make sure that my additional data in the publication_settings is still available after the submission has been published? I am very glad about any help!
Here you can see my code snippets:
HookRegistry::register('Schema::get::publication', array($this, 'addToSchema'));
HookRegistry::register('Publication::edit', array($this, 'editPublication'));
public function addToSchema($hookName, $args)
{
$schema = $args[0];
$exampleProperties = '{
"type": "string",
"multilingual": true,
"apiSummary": true,
"validation": [
"nullable"
]
}';
$examplePropertiesDecoded = json_decode($exampleProperties);
$schema->properties->{'examplePlugin::exampleProperties'} = $examplePropertiesDecoded;
}
function editPublication(string $hookname, array $args)
{
$newPublication = $args[0];
$params = $args[2];
$exampleProperties = 'Hey I am here';
$newPublication->setData('examplePlugin::exampleProperties', $exampleProperties, null);
}