Editor Events
Predefined Values
Verfügbar für: strict
Interace: \brandbox\editor\base\lib\event\editorPredefinedValuesEventInterface
Beschreibung: Zum Ändern oder Erweitern der predefinedValues im strict editor
Beispiel:
<?php
namespace brandbox\shop\article\lib\event {
use brandbox\component\event;
use brandbox\editor\base;
use brandbox\shop\impersonation;
/**
* @author Christopher Holden <holden@konmedia.com>
*/
class editorPredefinedValuesEvent extends event\eventAbstract implements base\lib\event\editorPredefinedValuesEventInterface {
/**
* @inheritDoc
*/
public function onPopulatePredefinedValues(&$predefinedValues) {
// example add dynamic value
$predefinedValues['editorPredefinedValuesTestField'] = date('d.m.Y H:i:s');
// example add user values
$user = $this
->staticController(impersonation\engine::class)
->getShopUser()
;
$additionalFieldIdentifiers = ['shopUserFirstname'];
foreach($additionalFieldIdentifiers as $additionalFieldIdentifier):
$predefinedValues['editor'.ucfirst($additionalFieldIdentifier)] = $user->{$additionalFieldIdentifier};
endforeach;
}
}
}
?>