function Message::getText
Same name in other branches
- 9 composer/Plugin/ProjectMessage/Message.php \Drupal\Composer\Plugin\ProjectMessage\Message::getText()
- 8.9.x composer/Plugin/ProjectMessage/Message.php \Drupal\Composer\Plugin\ProjectMessage\Message::getText()
- 10 composer/Plugin/ProjectMessage/Message.php \Drupal\Composer\Plugin\ProjectMessage\Message::getText()
File
-
composer/
Plugin/ ProjectMessage/ Message.php, line 48
Class
- Message
- Determine configuration.
Namespace
Drupal\Composer\Plugin\ProjectMessageCode
public function getText() {
if ($this->messageText) {
return $this->messageText;
}
$package_config = $this->rootPackage
->getExtra();
$file = $this->eventName . '-message.txt';
if ($config_file = $package_config['drupal-core-project-message'][$this->eventName . '-file'] ?? FALSE) {
$file = $config_file;
}
$message = $package_config['drupal-core-project-message'][$this->eventName . '-message'] ?? [];
if ($message) {
$this->messageText = $message;
}
else {
$this->messageText = $this->getMessageFromFile($file);
}
// Include structured support info from composer.json.
if ($config_keys = $package_config['drupal-core-project-message']['include-keys'] ?? FALSE) {
foreach ($config_keys as $config_key) {
switch ($config_key) {
case 'name':
if ($homepage = $this->rootPackage
->getName()) {
$this->messageText[] = ' * Name: ' . $homepage;
}
break;
case 'description':
if ($homepage = $this->rootPackage
->getDescription()) {
$this->messageText[] = ' * Description: ' . $homepage;
}
break;
case 'homepage':
if ($homepage = $this->rootPackage
->getHomepage()) {
$this->messageText[] = ' * Homepage: ' . $homepage;
}
break;
case 'support':
if ($support = $this->rootPackage
->getSupport()) {
$this->messageText[] = ' * Support:';
foreach ($support as $support_key => $support_value) {
$this->messageText[] = ' * ' . $support_key . ': ' . $support_value;
}
}
break;
}
}
}
return $this->messageText;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.