You are here

public function SyncState::getValueOptions in CMS Content Sync 2.0.x

Same name and namespace in other branches
  1. 8 modules/cms_content_sync_views/src/Plugin/views/filter/SyncState.php \Drupal\cms_content_sync_views\Plugin\views\filter\SyncState::getValueOptions()
  2. 2.1.x modules/cms_content_sync_views/src/Plugin/views/filter/SyncState.php \Drupal\cms_content_sync_views\Plugin\views\filter\SyncState::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/SyncState.php, line 37

Class

SyncState
Provides a view filter to filter on the sync state entity.

Namespace

Drupal\cms_content_sync_views\Plugin\views\filter

Code

public function getValueOptions() {

  // The entity type redirect provided by the redirect module (https://www.drupal.org/project/redirect)
  // does not have a changed date.
  if ($this->view
    ->getBaseEntityType()
    ->id() == 'redirect') {
    $value_options = [
      'pushed' => $this
        ->t('Is pushed'),
      'pulled' => $this
        ->t('Is pulled'),
      'overridden_locally' => $this
        ->t('Is overridden locally'),
    ];
  }
  else {
    $value_options = [
      'pushed' => $this
        ->t('Is pushed'),
      'pushed_update' => $this
        ->t('Is pushed - Update waiting'),
      'pulled' => $this
        ->t('Is pulled'),
      'overridden_locally' => $this
        ->t('Is overridden locally'),
    ];
  }
  if (!isset($this->valueOptions)) {
    $this->valueTitle = $this
      ->t('Content synchronization');
    $this->valueOptions = $value_options;
  }
  return $this->valueOptions;
}