You are here

public function Flag::setFlagTypePlugin in Flag 8.4

Set the flag type plugin.

Parameters

string $plugin_id: A string containing the flag type plugin ID.

Overrides FlagInterface::setFlagTypePlugin

File

src/Entity/Flag.php, line 279

Class

Flag
Provides the Flag configuration entity.

Namespace

Drupal\flag\Entity

Code

public function setFlagTypePlugin($plugin_id) {
  $this->flag_type = $plugin_id;

  // $this->flagTypeBag->addInstanceId($pluginID);
  // Workaround for https://www.drupal.org/node/2288805
  $this->flagTypeCollection = new DefaultSingleLazyPluginCollection(\Drupal::service('plugin.manager.flag.flagtype'), $this->flag_type, $this->flagTypeConfig);

  // Get the entity type from the plugin definition.
  $plugin = $this
    ->getFlagTypePlugin();
  $plugin_def = $plugin
    ->getPluginDefinition();
  $this->entity_type = $plugin_def['entity_type'];
}