public function UserConsentDataPolicyRevision::getValueOptions in Data Policy 8
Child classes should be used to override this function and set the 'value options', unless 'options callback' is defined as a valid function or static public method to generate these values.
This can use a guard to be used to reduce database hits as much as possible.
Return value
array|null The stored values from $this->valueOptions.
Overrides InOperator::getValueOptions
File
- src/
Plugin/ views/ filter/ UserConsentDataPolicyRevision.php, line 94
Class
- UserConsentDataPolicyRevision
- Simple filter to handle matching of multiple data policy revisions.
Namespace
Drupal\data_policy\Plugin\views\filterCode
public function getValueOptions() {
if (isset($this->valueOptions)) {
return $this->valueOptions;
}
$ids = $this->configFactory
->getEditable('data_policy.data_policy')
->get('revision_ids');
if (empty($ids)) {
return $this->valueOptions = [];
}
$this->valueOptions = $this->connection
->select('data_policy_revision', 'r')
->fields('r', [
'vid',
'revision_created',
])
->condition('vid', array_keys($ids), 'IN')
->orderBy('revision_created', 'DESC')
->execute()
->fetchAllKeyed();
foreach ($this->valueOptions as &$timestamp) {
$timestamp = $this->dateFormatter
->format($timestamp);
}
return $this->valueOptions;
}