function VariantCollectionTrait::getVariants

Same name in other branches
  1. 8.x-3.x src/Plugin/VariantCollectionTrait.php \Drupal\ctools\Plugin\VariantCollectionTrait::getVariants()

See also

\Drupal\ctools\Plugin\VariantCollectionInterface::getVariants()

File

src/Plugin/VariantCollectionTrait.php, line 44

Class

VariantCollectionTrait
Provides methods for VariantCollectionInterface.

Namespace

Drupal\ctools\Plugin

Code

public function getVariants() {
    if (!$this->variantCollection) {
        $this->variantCollection = new VariantPluginCollection(\Drupal::service('plugin.manager.display_variant'), $this->getVariantConfig());
        $this->variantCollection
            ->sort();
    }
    return $this->variantCollection;
}