public function Flow::getValueOptions in CMS Content Sync 2.0.x
Same name and namespace in other branches
- 8 modules/cms_content_sync_views/src/Plugin/views/filter/Flow.php \Drupal\cms_content_sync_views\Plugin\views\filter\Flow::getValueOptions()
- 2.1.x modules/cms_content_sync_views/src/Plugin/views/filter/Flow.php \Drupal\cms_content_sync_views\Plugin\views\filter\Flow::getValueOptions()
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
- modules/
cms_content_sync_views/ src/ Plugin/ views/ filter/ Flow.php, line 20
Class
- Flow
- Provides a view filter to filter on the sync state entity.
Namespace
Drupal\cms_content_sync_views\Plugin\views\filterCode
public function getValueOptions() {
if (!isset($this->valueOptions)) {
$this->valueTitle = $this
->t('Flows');
// @codingStandardsIgnoreStart
$flows = \Drupal\cms_content_sync\Entity\Flow::getAll();
// @codingStandardsIgnoreEnd
foreach ($flows as $flow_name => $flow) {
$this->valueOptions[$flow_name] = $flow
->label();
}
if (!empty($this->valueOptions)) {
return $this->valueOptions;
}
}
return $this->valueOptions['none'] = $this
->t('None');
}