コード例 #1
0
ファイル: DisplayTest.php プロジェクト: ddrozdik/dmaps
 /**
  * {@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;
     }
 }
コード例 #2
0
ファイル: DisplayTest.php プロジェクト: alnutile/drunatra
 /**
  * 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;
     }
 }
コード例 #3
0
 /**
  * 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'), '/ '));
     }
 }
コード例 #4
0
ファイル: PathPluginBase.php プロジェクト: alnutile/drunatra
 /**
  * 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'], '/ ');
     }
 }