You are here

protected function UserConsentDataPolicyRevision::defineOptions in Data Policy 8

Information about options for all kinds of purposes will be held here.


'option_name' => array(
 - 'default' => default value,
 - 'contains' => (optional) array of items this contains, with its own
     defaults, etc. If contains is set, the default will be ignored and
     assumed to be array().
 ),

Return value

array Returns the options of this handler/plugin.

Overrides InOperator::defineOptions

File

src/Plugin/views/filter/UserConsentDataPolicyRevision.php, line 123

Class

UserConsentDataPolicyRevision
Simple filter to handle matching of multiple data policy revisions.

Namespace

Drupal\data_policy\Plugin\views\filter

Code

protected function defineOptions() {
  $options = parent::defineOptions();
  $entity_id = $this->configFactory
    ->getEditable('data_policy.data_policy')
    ->get('entity_id');
  if (!empty($entity_id)) {
    $revision_id = $this->entityTypeManager
      ->getStorage('data_policy')
      ->load($entity_id)
      ->getRevisionId();
    $options['value']['default'] = [
      $revision_id,
    ];
  }
  return $options;
}