Пример #1
0
 /**
  * {@inheritdoc}
  */
 public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL)
 {
     parent::init($view, $display, $options);
     // @todo Remove the legacy code.
     // Convert legacy vids option to machine name vocabularies.
     if (!empty($this->options['vids'])) {
         $vocabularies = taxonomy_vocabulary_get_names();
         foreach ($this->options['vids'] as $vid) {
             if (isset($vocabularies[$vid], $vocabularies[$vid]->machine_name)) {
                 $this->options['vocabularies'][$vocabularies[$vid]->machine_name] = $vocabularies[$vid]->machine_name;
             }
         }
     }
 }
Пример #2
0
 /**
  * Tests the validate argument method with multiple argument splitting.
  */
 public function testValidateArgumentMultiple()
 {
     $options = array();
     $options['access'] = TRUE;
     $options['bundles'] = array();
     $options['operation'] = 'test_op';
     $options['multiple'] = TRUE;
     $this->argumentValidator->init($this->executable, $this->display, $options);
     $this->assertTrue($this->argumentValidator->validateArgument('1'));
     $this->assertFalse($this->argumentValidator->validateArgument('2'));
     $this->assertFalse($this->argumentValidator->validateArgument('1,2'));
     $this->assertFalse($this->argumentValidator->validateArgument('1+2'));
     $options = array();
     $options['access'] = TRUE;
     $options['bundles'] = array();
     $options['operation'] = 'test_op_3';
     $options['multiple'] = TRUE;
     $this->argumentValidator->init($this->executable, $this->display, $options);
     $this->assertTrue($this->argumentValidator->validateArgument('1,2'));
     $this->assertTrue($this->argumentValidator->validateArgument('1+2'));
 }