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


PHP Widget::addError方法代碼示例

本文整理匯總了PHP中Widget::addError方法的典型用法代碼示例。如果您正苦於以下問題:PHP Widget::addError方法的具體用法?PHP Widget::addError怎麽用?PHP Widget::addError使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Widget的用法示例。


在下文中一共展示了Widget::addError方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: positiveFloatRegExpHook

 public function positiveFloatRegExpHook($strRegexp, $varValue, \Widget $objWidget)
 {
     if ($strRegexp == 'posfloat') {
         if (strpos($varValue, ',') != false) {
             $objWidget->addError($GLOBALS['TL_LANG']['ERR']['posFloat']['commaFound']);
         }
         if (!preg_match('/^\\d+(?:\\.\\d+)?$/', $varValue)) {
             $objWidget->addError($GLOBALS['TL_LANG']['ERR']['posFloat']['noFloat']);
         }
         return true;
     }
     return false;
 }
開發者ID:heimrichhannot,項目名稱:contao-haste_plus,代碼行數:13,代碼來源:Numbers.php

示例2: hookAddCustomRegexp

 /**
  * Add the custom regexp "dezimal" to Contao.
  */
 public function hookAddCustomRegexp($strRegexp, $varValue, \Widget $objWidget)
 {
     if ($strRegexp == 'dezimal') {
         if (!preg_match('/^\\-?\\d+(,\\d+)?$/', trim($varValue))) {
             $objWidget->addError(sprintf($GLOBALS['TL_LANG']['ERR']['digit'], $objWidget->label));
         }
         return true;
     }
     return false;
 }
開發者ID:bit3,項目名稱:contao-deutsche-zahlen,代碼行數:13,代碼來源:DeutscheZahlen.php

示例3: validateVotingEmailFormField

 public function validateVotingEmailFormField(\Widget $objWidget, $intId)
 {
     if (($objForm = \FormModel::findBy('alias', str_replace('auto_', '', $intId))) !== null && $objForm->maxVoteCount) {
         // check if a voting from the mail address already exists
         $db = \Database::getInstance();
         $objEmailCheck = $db->prepare('SELECT * FROM tl_formdata_details fdt INNER JOIN tl_formdata fd ON fdt.pid=fd.id INNER JOIN tl_form f ON fd.form=f.title WHERE fdt.ff_name=? AND fdt.value=? AND f.alias=?')->execute('email', $objWidget->value, $objForm->alias);
         if ($objEmailCheck->numRows > 0 && $objEmailCheck->numRows >= $objForm->maxVoteCount) {
             $objWidget->addError(sprintf($GLOBALS['TL_LANG']['email_voting']['maxVoteCount'], $objForm->maxVoteCount));
         }
     }
     return $objWidget;
 }
開發者ID:heimrichhannot,項目名稱:contao-email_voting,代碼行數:12,代碼來源:EmailVoting.php

示例4: validateRegexp

 /**
  * Validate a custom regular expression
  * @param string
  * @param mixed
  * @param object
  * @return boolean
  */
 public function validateRegexp($strRegexp, $varValue, Widget $objWidget)
 {
     switch ($strRegexp) {
         case 'price':
             if (!preg_match('/^[\\d \\.-]*$/', $varValue)) {
                 $objWidget->addError(sprintf($GLOBALS['TL_LANG']['ERR']['digit'], $objWidget->label));
             }
             return true;
             break;
         case 'discount':
             if (!preg_match('/^[-+]\\d+(\\.\\d{1,2})?%?$/', $varValue)) {
                 $objWidget->addError(sprintf($GLOBALS['TL_LANG']['ERR']['discount'], $objWidget->label));
             }
             return true;
             break;
         case 'surcharge':
             if (!preg_match('/^-?\\d+(\\.\\d{1,2})?%?$/', $varValue)) {
                 $objWidget->addError(sprintf($GLOBALS['TL_LANG']['ERR']['surcharge'], $objWidget->label));
             }
             return true;
             break;
     }
     return false;
 }
開發者ID:rburch,項目名稱:core-1,代碼行數:31,代碼來源:Isotope.php

示例5: doCheckForDoubleReviews

 protected static function doCheckForDoubleReviews(\Widget $objWidget, $varValue, $strTable)
 {
     if ($strTable == 'tl_competition_review' && ($objReview = ReviewModel::findByPk(\Input::get('id'))) !== null) {
         $objReviews = \HeimrichHannot\Competition\ReviewModel::findOneBy(array('sid=?', 'jid=?', 'tl_competition_review.id!=?'), array($varValue, $objReview->jid, \Input::get('id')));
         // check for already existing reviews by the member for the current submission
         if ($objReviews !== null) {
             $objWidget->addError($GLOBALS['TL_LANG']['MSC']['reviewAlreadyExisting']);
         }
     }
 }
開發者ID:heimrichhannot,項目名稱:contao-competition,代碼行數:10,代碼來源:Competition.php

示例6: handleSaveCallback

 /**
  * Handle the onsave_callback for a widget.
  *
  * @param array   $field  The field DCA.
  *
  * @param \Widget $widget The widget to validate.
  *
  * @param mixed   $value  The value.
  *
  * @return mixed
  */
 protected function handleSaveCallback($field, $widget, $value)
 {
     $newValue = $value;
     if (is_array($field['save_callback'])) {
         foreach ($field['save_callback'] as $callback) {
             $this->import($callback[0]);
             try {
                 $newValue = $this->{$callback}[0]->{$callback}[1]($newValue, $this);
             } catch (\Exception $e) {
                 $widget->addError($e->getMessage());
                 $this->blnSubmitInput = false;
                 return $value;
             }
         }
     }
     return $newValue;
 }
開發者ID:zonky2,項目名稱:core,代碼行數:28,代碼來源:SubDcaWidget.php

示例7: customRegexp

 /**
  * Check for customer regular expression
  *
  * @param string $strRegexp
  *
  * @param string $varValue
  *
  * @param Widget $objWidget
  *
  * @return boolean
  */
 public function customRegexp($strRegexp, $varValue, Widget $objWidget)
 {
     switch ($strRegexp) {
         case 'colorRgb':
             if (!preg_match('/^([0-9a-f]{3}|[0-9a-f]{6})$/i', $varValue)) {
                 $objWidget->addError('Field ' . $objWidget->label . ' should be a color RGB code.');
             }
             return true;
             break;
     }
     return false;
 }
開發者ID:menatwork,項目名稱:synccto,代碼行數:23,代碼來源:SyncCtoHelper.php


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