当前位置: 首页>>代码示例>>PHP>>正文


PHP DisplayPluginBase::validateOptionsForm方法代码示例

本文整理汇总了PHP中Drupal\views\Plugin\views\display\DisplayPluginBase::validateOptionsForm方法的典型用法代码示例。如果您正苦于以下问题:PHP DisplayPluginBase::validateOptionsForm方法的具体用法?PHP DisplayPluginBase::validateOptionsForm怎么用?PHP DisplayPluginBase::validateOptionsForm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Drupal\views\Plugin\views\display\DisplayPluginBase的用法示例。


在下文中一共展示了DisplayPluginBase::validateOptionsForm方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: validateOptionsForm

 /**
  * {@inheritdoc}
  */
 public function validateOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::validateOptionsForm($form, $form_state);
     \Drupal::logger('views')->notice($form_state->getValue('test_option'));
     switch ($form_state->get('section')) {
         case 'test_option':
             if (!trim($form_state->getValue('test_option'))) {
                 $form_state->setError($form['test_option'], $this->t('You cannot have an empty option.'));
             }
             break;
     }
 }
开发者ID:ddrozdik,项目名称:dmaps,代码行数:15,代码来源:DisplayTest.php

示例2: validateOptionsForm

 /**
  * Overrides Drupal\views\Plugin\views\display\DisplayPluginBase::validateOptionsForm().
  */
 public function validateOptionsForm(&$form, &$form_state)
 {
     parent::validateOptionsForm($form, $form_state);
     watchdog('views', $form_state['values']['test_option']);
     switch ($form_state['section']) {
         case 'test_option':
             if (!trim($form_state['values']['test_option'])) {
                 form_error($form['test_option'], $form_state, t('You cannot have an empty option.'));
             }
             break;
     }
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:15,代码来源:DisplayTest.php

示例3: validateOptionsForm

 /**
  * Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::validateOptionsForm().
  */
 public function validateOptionsForm(&$form, FormStateInterface $form_state)
 {
     parent::validateOptionsForm($form, $form_state);
     if ($form_state->get('section') == 'path') {
         $errors = $this->validatePath($form_state->getValue('path'));
         foreach ($errors as $error) {
             $form_state->setError($form['path'], $error);
         }
         // Automatically remove '/' and trailing whitespace from path.
         $form_state->setValue('path', trim($form_state->getValue('path'), '/ '));
     }
 }
开发者ID:HakS,项目名称:drupal8_training,代码行数:15,代码来源:PathPluginBase.php

示例4: validateOptionsForm

 /**
  * Overrides \Drupal\views\Plugin\views\display\DisplayPluginBase::validateOptionsForm().
  */
 public function validateOptionsForm(&$form, &$form_state)
 {
     parent::validateOptionsForm($form, $form_state);
     if ($form_state['section'] == 'path') {
         $errors = $this->validatePath($form_state['values']['path']);
         foreach ($errors as $error) {
             $this->formError->setError($form['path'], $form_state, $error);
         }
         // Automatically remove '/' and trailing whitespace from path.
         $form_state['values']['path'] = trim($form_state['values']['path'], '/ ');
     }
 }
开发者ID:alnutile,项目名称:drunatra,代码行数:15,代码来源:PathPluginBase.php


注:本文中的Drupal\views\Plugin\views\display\DisplayPluginBase::validateOptionsForm方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。