function ComposerInspector::getAllowPluginsConfig

Returns the value of `allow-plugins` config setting.

Parameters

string $dir: The directory in which to run Composer.

Return value

bool[]|bool An array of boolean flags to allow or disallow certain plugins, or TRUE if all plugins are allowed.

See also

https://getcomposer.org/doc/06-config.md#allow-plugins

File

core/modules/package_manager/src/ComposerInspector.php, line 470

Class

ComposerInspector
Defines a class to get information from Composer.

Namespace

Drupal\package_manager

Code

public function getAllowPluginsConfig(string $dir) : array|bool {
    $value = $this->getConfig('allow-plugins', $dir);
    // Try to convert the value we got back to a boolean. If it's not a boolean,
    // it should be an array of plugin-specific flags.
    $value = json_decode($value, TRUE, flags: JSON_THROW_ON_ERROR);
    // An empty array indicates that no plugins are allowed.
    return $value ?: [];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.