當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Model::subscribeToEvent方法代碼示例

本文整理匯總了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'));
 }
開發者ID:webleads,項目名稱:form-builder-mailer,代碼行數:15,代碼來源:Installer.php

示例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');
         }
     }
 }
開發者ID:webleads,項目名稱:form-builder-mailer,代碼行數:21,代碼來源:Settings.php


注:本文中的Backend\Core\Engine\Model::subscribeToEvent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。