Can I disable Upload question type, removing it from the list of available questions?
I don't want Survey Administrator add Upload Questions to their surveys.
I wrote a plugin with this piece of code but is not working. Any idea how to disable Question Save event?
Code:
public function beforeQuestionSave()
{
$event = $this->getEvent();
$model = $event->get('model');
$sQuestionType = $model->attributes['type'];
if ('|' == $sQuestionType) {
$event->set('success', false);
$event->set('message', 'Question type not allowed');
}
}
Writing $event->set('success', false) inside event beforeActivate, is enough for deny the activity. Looks like doesn't work the same in beforeQuestionSave hook event.