17 import(
'lib.pkp.classes.form.Form');
33 parent::__construct($template);
41 $this->
addCheck(
new FormValidator($this,
'blockName',
'required',
'plugins.generic.customBlock.nameRequired'));
42 $this->
addCheck(
new FormValidatorRegExp($this,
'blockName',
'required',
'plugins.generic.customBlock.nameRegEx',
'/^[a-zA-Z0-9_-]+$/'));
57 $blockName =
$plugin->getName();
60 $this->
setData(
'blockContent', $blockContent);
61 $this->
setData(
'blockName', $blockName);
74 function execute(...$functionArgs) {
79 import(
'plugins.generic.customBlockManager.CustomBlockPlugin');
87 $blocks = $customBlockManagerPlugin->getSetting(
$contextId,
'blocks');
88 if (!isset($blocks)) $blocks = array();
90 array_push($blocks, $this->
getData(
'blockName'));
91 $customBlockManagerPlugin->updateSetting(
$contextId,
'blocks', $blocks);
97 parent::execute(...$functionArgs);