You are here

public function InstallableLibrary::createObjectRequirement in Markdown 8.2

File

src/Annotation/InstallableLibrary.php, line 96

Class

InstallableLibrary

Namespace

Drupal\markdown\Annotation

Code

public function createObjectRequirement(InstallablePlugin $definition = NULL) {
  if ($this->object) {
    $name = $this
      ->getLink($this->customLabel) ?: $this
      ->getId();
    if (!$name && $definition) {
      $name = $definition
        ->getLink($this->customLabel) ?: $definition
        ->getId();
    }
    return InstallableRequirement::create([
      'value' => $this->object,
      'constraints' => [
        'Installed' => [
          'name' => $name,
        ],
      ],
    ]);
  }
}