当前位置: 首页>>代码示例>>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;未经允许,请勿转载。