Esempio n. 1
0
 /**
  * {@inheritdoc}
  */
 public function calculateDependencies()
 {
     $dependencies = parent::calculateDependencies();
     foreach ($this->entityManager->getStorage('user_role')->loadMultiple(array_keys($this->options['roles'])) as $role) {
         $dependencies[$role->getConfigDependencyKey()][] = $role->getConfigDependencyName();
     }
     return $dependencies;
 }
Esempio n. 2
0
  /**
   * {@inheritdoc}
   */
  public function buildOptionsForm(&$form, FormStateInterface $form_state) {
    parent::buildOptionsForm($form, $form_state);

    $form['transform'] = array(
      '#type' => 'checkbox',
      '#title' => $this->t('Transform dashes in URL to underscores in term name filter values'),
      '#default_value' => $this->options['transform'],
    );
  }
Esempio n. 3
0
File: User.php Progetto: shumer/blog
 /**
  * {@inheritdoc}
  */
 protected function validateEntity(EntityInterface $entity)
 {
     /** @var \Drupal\user\UserInterface $entity */
     $role_check_success = TRUE;
     // See if we're filtering users based on roles.
     if (!empty($this->options['restrict_roles']) && !empty($this->options['roles'])) {
         $roles = $this->options['roles'];
         if (!(bool) array_intersect($entity->getRoles(), $roles)) {
             $role_check_success = FALSE;
         }
     }
     return $role_check_success && parent::validateEntity($entity);
 }
Esempio n. 4
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;
             }
         }
     }
 }
Esempio n. 5
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'));
 }