@@ -35,7 +35,6 @@ public function __construct($plugin, $contextId)
3535
3636 parent ::__construct ($ plugin ->getTemplateResource ('conferenceDataForm.tpl ' ));
3737
38- $ this ->addCheck (new FormValidator ($ this , 'conferenceName ' , 'required ' , 'plugins.importexport.crossrefConference.settings.form.conferenceNameRequired ' ));
3938 $ this ->addCheck (new FormValidatorPost ($ this ));
4039 $ this ->addCheck (new FormValidatorCSRF ($ this ));
4140 }
@@ -44,21 +43,25 @@ public function initData()
4443 {
4544 $ contextId = $ this ->_getContextId ();
4645 $ plugin = $ this ->_getPlugin ();
47- foreach ($ this ->getFormFields () as $ fieldName => $ fieldType ) {
46+ foreach ($ this ->getFormFields () as $ fieldName => $ fieldType ) {
4847 $ this ->setData ($ fieldName , $ plugin ->getSetting ($ contextId , $ fieldName ));
4948 }
5049 }
5150
5251 public function readInputData ()
5352 {
5453 $ this ->readUserVars (array_keys ($ this ->getFormFields ()));
54+ $ this ->addCheck (new FormValidator ($ this , 'conferenceNameOption ' , 'required ' , 'plugins.importexport.crossrefConference.settings.form.conferenceNameRequired ' ));
55+ if ($ this ->getData ('conferenceNameOption ' ) === 'custom ' ) {
56+ $ this ->addCheck (new FormValidator ($ this , 'conferenceName ' , 'required ' , 'plugins.importexport.crossrefConference.settings.form.conferenceNameRequired ' ));
57+ }
5558 }
5659
5760 public function execute (...$ functionArgs )
5861 {
5962 $ plugin = $ this ->_getPlugin ();
6063 $ contextId = $ this ->_getContextId ();
61- foreach ($ this ->getFormFields () as $ fieldName => $ fieldType ) {
64+ foreach ($ this ->getFormFields () as $ fieldName => $ fieldType ) {
6265 $ plugin ->updateSetting ($ contextId , $ fieldName , $ this ->getData ($ fieldName ), $ fieldType );
6366 }
6467 parent ::execute (...$ functionArgs );
@@ -67,7 +70,8 @@ public function execute(...$functionArgs)
6770 public function getFormFields ()
6871 {
6972 return array (
70- 'conferenceName ' => 'string '
73+ 'conferenceName ' => 'string ' ,
74+ 'conferenceNameOption ' => 'string '
7175 );
7276 }
7377}
0 commit comments