Fix: "Add [entity-type]" button on the dashboard was untranslatable

This commit is contained in:
Jan Sonntag 2022-01-07 14:00:19 +01:00 committed by Michael Stenta
parent 77274b9285
commit e7a3178a46
1 changed files with 4 additions and 1 deletions

View File

@ -4,12 +4,15 @@ namespace Drupal\farm_ui_action\Plugin\Derivative;
use Drupal\Component\Plugin\Derivative\DeriverBase;
use Drupal\Component\Utility\Unicode;
use Drupal\Core\StringTranslation\StringTranslationTrait;
/**
* Defines farmOS action links.
*/
class FarmActions extends DeriverBase {
use StringTranslationTrait;
/**
* {@inheritdoc}
*/
@ -36,7 +39,7 @@ class FarmActions extends DeriverBase {
// Generate a link to [entity-type]/add.
$name = 'farm.add.' . $type;
$this->derivatives[$name] = $base_plugin_definition;
$this->derivatives[$name]['title'] = 'Add ' . Unicode::ucfirst($type);
$this->derivatives[$name]['title'] = $this->t('Add :entity_type', [':entity_type' => Unicode::ucfirst($type)]);
$this->derivatives[$name]['route_name'] = 'entity.' . $type . '.add_page';
// Add it to entity Views, if the farm_ui_views module is enabled.