本文整理匯總了PHP中Backend\Core\Engine\Model::subscribeToEvent方法的典型用法代碼示例。如果您正苦於以下問題:PHP Model::subscribeToEvent方法的具體用法?PHP Model::subscribeToEvent怎麽用?PHP Model::subscribeToEvent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Backend\Core\Engine\Model
的用法示例。
在下文中一共展示了Model::subscribeToEvent方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: install
public function install()
{
// install the module in the database
$this->addModule('FormBuilderMailer');
// install the locale, this is set here because we need the module for this
$this->importLocale(dirname(__FILE__) . '/Data/locale.xml');
$this->setModuleRights(1, 'FormBuilderMailer');
$this->setActionRights(1, 'FormBuilderMailer', 'Settings');
// settings navigation
$navigationSettingsId = $this->setNavigation(null, 'Settings');
$navigationModulesId = $this->setNavigation($navigationSettingsId, 'Modules');
$this->setNavigation($navigationModulesId, 'FormBuilderMailer', 'form_builder_mailer/settings');
BackendModel::setModuleSetting('FormBuilderMailer', 'enabled', true);
BackendModel::subscribeToEvent('Formbuilder', 'after_submission', 'FormBuilderMailer', array('Backend\\Modules\\FormBuilderMailer\\Engine\\Model', 'afterFormSubmission'));
}
示例2: validateForm
/**
* Validates the settings form
*/
private function validateForm()
{
if ($this->frm->isSubmitted()) {
if ($this->frm->isCorrect()) {
$enabled = (bool) $this->frm->getField('enabled')->getValue();
BackendModel::setModuleSetting($this->URL->getModule(), 'enabled', $enabled);
if ($enabled) {
BackendModel::subscribeToEvent('Formbuilder', 'after_submission', 'FormBuilderMailer', array('\\Backend\\Modules\\FormBuilderMailer\\Engine\\Model', 'afterFormSubmission'));
} else {
BackendModel::unsubscribeFromEvent('Formbuilder', 'after_submission', 'FormBuilderMailer');
}
BackendModel::setModuleSetting($this->URL->getModule(), 'log', (bool) $this->frm->getField('log')->getValue());
BackendModel::setModuleSetting($this->URL->getModule(), 'add_data', (bool) $this->frm->getField('add_data')->getValue());
BackendModel::triggerEvent($this->getModule(), 'after_saved_settings');
$this->redirect(BackendModel::createURLForAction('settings') . '&report=saved');
}
}
}