public function Hooks::setBaseProfileFieldValue in Lightning Core 8.5
Same name and namespace in other branches
- 8.4 src/Commands/Hooks.php \Drupal\lightning_core\Commands\Hooks::setBaseProfileFieldValue()
Sets the base-profile field value in core:status.
@hook alter core:status
Parameters
mixed $result: The result of the core:status command before alteration.
\Consolidation\AnnotatedCommand\CommandData $command_data: The Drush command data.
See also
::defineExtraStatusFields()
File
- src/
Commands/ Hooks.php, line 103
Class
- Hooks
- Implements Drush command hooks.
Namespace
Drupal\lightning_core\CommandsCode
public function setBaseProfileFieldValue($result, CommandData $command_data) {
$info = $this->profileList
->get($this->installProfile);
if (isset($info->info['base profile'])) {
$base_profile = $info->info['base profile'];
}
else {
$base_profile = t('This profile does not extend a base profile.');
}
$formatter_options = $command_data
->formatterOptions();
// Add a field label for our new 'base-profile' field. This is required
// in order for this field to be selectable; otherwise, our structured
// data formatters will remove it.
$field_labels = $formatter_options
->get(FormatterOptions::FIELD_LABELS);
$field_labels['base-profile'] = t('Base Profile');
$formatter_options
->setFieldLabels($field_labels);
// Add our data to the new field.
$result['base-profile'] = $base_profile;
return $result;
}