diff -ru a/composer.json b/composer.json --- a/composer.json 2026-09-07 18:20:40.954418746 +0200 +++ b/composer.json 2026-09-07 18:20:52.314018206 +0200 @@ -9,6 +9,6 @@ } ], "require": { - "farmos/farmos": "^3.0" + "farmos/farmos": "^3.0 || ^4.0" } } diff -ru a/farm_template.info.yml b/farm_template.info.yml --- a/farm_template.info.yml 2026-09-07 18:20:40.963572391 +0200 +++ b/farm_template.info.yml 2026-09-07 18:20:40.962985444 +0200 @@ -2,7 +2,7 @@ type: module description: Provides features to create templates for standardized record keeping and planning. package: farmOS Contrib -core_version_requirement: ^10 +core_version_requirement: ^10 || ^11 # Information added by Drupal.org packaging script on 2024-06-22 version: '1.0.0-alpha3' diff -ru a/src/Controller/RecordTemplateController.php b/src/Controller/RecordTemplateController.php --- a/src/Controller/RecordTemplateController.php 2026-09-07 18:20:40.955289475 +0200 +++ b/src/Controller/RecordTemplateController.php 2026-09-07 18:20:40.961317485 +0200 @@ -51,7 +51,7 @@ * @return array * Returns a render array. */ - public function asset(AssetType $asset_type = NULL): array { + public function asset(?AssetType $asset_type = NULL): array { // Start cacheability object with template config entity list tag. $template_storage = $this->entityTypeManager()->getStorage('farm_record_template'); @@ -108,7 +108,7 @@ * @return array * Returns a render array. */ - public function log(LogType $log_type = NULL): array { + public function log(?LogType $log_type = NULL): array { // Start cacheability object with template config entity list tag. $template_storage = $this->entityTypeManager()->getStorage('farm_record_template'); diff -ru a/src/Element/Quantity.php b/src/Element/Quantity.php --- a/src/Element/Quantity.php 2026-09-07 18:20:40.955319145 +0200 +++ b/src/Element/Quantity.php 2026-09-07 18:20:40.961514642 +0200 @@ -6,6 +6,7 @@ use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Render\Element\FormElement; use Drupal\quantity\Entity\Quantity as QuantityEntity; +use Drupal\quantity\QuantityHelper; use Drupal\taxonomy\Entity\Term; use Drupal\taxonomy\TermInterface; @@ -50,7 +51,7 @@ '#title' => $this->t('Units'), '#weight' => 10, ], - '#measure_options' => quantity_measure_options(), + '#measure_options' => QuantityHelper::quantityMeasureOptions(), 'measure' => [ '#title' => $this->t('Measure'), '#weight' => 15, diff -ru a/src/Form/TemplateForm.php b/src/Form/TemplateForm.php --- a/src/Form/TemplateForm.php 2026-09-07 18:20:40.955471966 +0200 +++ b/src/Form/TemplateForm.php 2026-09-07 18:20:40.961885882 +0200 @@ -33,7 +33,7 @@ * @return \Drupal\Core\Access\AccessResultInterface * The access result. */ - public function access(AccountInterface $account, RecordTemplate $farm_record_template = NULL) { + public function access(AccountInterface $account, ?RecordTemplate $farm_record_template = NULL) { if (is_null($farm_record_template)) { throw new ResourceNotFoundException(); } @@ -45,7 +45,7 @@ /** * {@inheritdoc} */ - public function buildForm(array $form, FormStateInterface $form_state, RecordTemplate $farm_record_template = NULL) { + public function buildForm(array $form, FormStateInterface $form_state, ?RecordTemplate $farm_record_template = NULL) { $template = $farm_record_template; $form_state->set('template', $template); diff -ru a/src/Plugin/QuickForm/Template.php b/src/Plugin/QuickForm/Template.php --- a/src/Plugin/QuickForm/Template.php 2026-09-07 18:20:40.955608729 +0200 +++ b/src/Plugin/QuickForm/Template.php 2026-09-07 18:20:40.962420817 +0200 @@ -37,20 +37,6 @@ use QuickTermTrait; /** - * The entity type manager service. - * - * @var \Drupal\Core\Entity\EntityTypeManagerInterface - */ - protected $entityTypeManager; - - /** - * Current user object. - * - * @var \Drupal\Core\Session\AccountInterface - */ - protected $currentUser; - - /** * Constructs a QuickFormBase object. * * @param array $configuration @@ -67,10 +53,8 @@ * Current user object. */ public function __construct(array $configuration, $plugin_id, $plugin_definition, MessengerInterface $messenger, EntityTypeManagerInterface $entity_type_manager, AccountInterface $current_user) { - parent::__construct($configuration, $plugin_id, $plugin_definition, $messenger); + parent::__construct($configuration, $plugin_id, $plugin_definition, $entity_type_manager, $current_user); $this->messenger = $messenger; - $this->entityTypeManager = $entity_type_manager; - $this->currentUser = $current_user; } /** diff -ru a/src/Plugin/Template/Widget/Quantity.php b/src/Plugin/Template/Widget/Quantity.php --- a/src/Plugin/Template/Widget/Quantity.php 2026-09-07 18:20:40.955719498 +0200 +++ b/src/Plugin/Template/Widget/Quantity.php 2026-09-07 18:20:40.962813158 +0200 @@ -7,6 +7,7 @@ use Drupal\Core\Form\FormStateInterface; use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\farm_template\Attribute\TemplateWidget; +use Drupal\quantity\QuantityHelper; #[TemplateWidget( id: "quantity", @@ -92,7 +93,7 @@ $form['measure_value'] = [ '#type' => 'select', '#title' => new TranslatableMarkup('Quantity measure'), - '#options' => quantity_measure_options(), + '#options' => QuantityHelper::quantityMeasureOptions(), '#default_value' => $this->getWidgetSetting('measure_value'), '#empty_option' => '', ];