You are here

public function FlagViewsFlaggedField::init in Flag 8.4

Initialize the plugin.

Parameters

\Drupal\views\ViewExecutable $view: The view object.

\Drupal\views\Plugin\views\display\DisplayPluginBase $display: The display handler.

array $options: The options configured for this plugin.

Overrides Boolean::init

File

src/Plugin/views/field/FlagViewsFlaggedField.php, line 25

Class

FlagViewsFlaggedField
Provides a views field to show if the selected content is flagged or not.

Namespace

Drupal\flag\Plugin\views\field

Code

public function init(ViewExecutable $view, DisplayPluginBase $display, array &$options = NULL) {
  parent::init($view, $display, $options);

  // Add our boolean labels.
  $this->formats['flag'] = [
    $this
      ->t('Flagged'),
    $this
      ->t('Not flagged'),
  ];

  // TODO: We could probably lift the '(Un)Flagged message' strings from the
  // flag object, but a) we need to lift that from the relationship we're on
  // and b) they will not necessarily make sense in a static context.
}