Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/Commands/field/FieldCreateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
use Drush\Event\FieldCreateFieldConfigValuesEvent;
use Drush\Event\FieldCreateFieldStorageConfigValuesEvent;
use Drush\Event\FieldCreateInputOptionsEvent;
use Drush\Log\SuccessInterface;
use Psr\EventDispatcher\EventDispatcherInterface;
use Psr\Log\LoggerInterface;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Completion\CompletionInput;
Expand Down Expand Up @@ -69,6 +71,7 @@ public function __construct(
private readonly ModuleHandlerInterface $moduleHandler,
private readonly EntityFieldManagerInterface $entityFieldManager,
private readonly EventDispatcherInterface $eventDispatcher,
private readonly LoggerInterface $logger,
private readonly ?ContentTranslationManagerInterface $contentTranslationManager = null,
) {
parent::__construct();
Expand Down Expand Up @@ -493,7 +496,8 @@ protected function getEntityDisplay(string $context): ?EntityDisplayInterface

protected function logResult(FieldConfigInterface $field): void
{
$this->io()->success(
assert($this->logger instanceof SuccessInterface);
$this->logger->success(
Comment on lines 499 to 500
Copy link
Member

@weitzman weitzman Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldnt we use io when we use success()? Thats what fieldDelete is doing ... Oh, its because we should a hyperlink later. I would rather give up the hyperlink than make success() usage inconsistent. or lets fix io so it can print hyperlinks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It used logger before, I changed it in #6468. Changing it back now to work around the hyperlink issue. Already spent a lot of time on #6481, don't really feel like diving into that hyperlink issue now. Would be a shame to lose the hyperlink here, I actually use it a lot.

sprintf(
"Successfully created field '%s' on %s type with bundle '%s'",
$field->get('field_name'),
Expand All @@ -512,7 +516,7 @@ protected function logResult(FieldConfigInterface $field): void
];

if ($this->moduleHandler->moduleExists('field_ui')) {
$this->io()->success(
$this->logger->success(
dt('Further customisation can be done through the <href=%editForm>edit form</>.', [
'%editForm' => Url::fromRoute($routeName, $routeParams)->setAbsolute(true)->toString(),
]),
Expand Down