public function InstallablePlugin::getRequirementsByType in Markdown 8.2
Retrieves requirements of a certain type.
Parameters
string $type: The requirement type to limit by.
string $id: Optional. A specific identifier to limit by.
Return value
\Drupal\markdown\Annotation\InstallableRequirement[] An array of requirements matching the type.
File
- src/
Annotation/ InstallablePlugin.php, line 75
Class
- InstallablePlugin
- Base annotation for "installable" plugins.
Namespace
Drupal\markdown\AnnotationCode
public function getRequirementsByType($type, $id = NULL) {
$requirements = [];
foreach (array_merge($this->requirements, $this->runtimeRequirements) as $requirement) {
if (!$requirement instanceof InstallableRequirement) {
continue;
}
list($t, $i) = $requirement
->listTypeId();
if ($type === $t) {
if (isset($id) && $id !== $i) {
continue;
}
$requirements[] = $requirement;
}
}
return $requirements;
}