Template module on farmOS 4.n

@paul121 @mstenta
I hold back updating to farmOS 4.n due to the Template module.
It requires version 3 of farmOS. Are there any known issues running it on version 4?

1 Like

Do you mean this one?

I don’t know, but as I understand it that module has never had a “stable” release and there hasn’t been any more work on it in > 2 years.

You could try updating the farm_template.info.yml file to force it to work in v4, so you can test it out. My guess is it will still work, but you might want to consider alternatives because it may end up as a drag on your ability to update.

Yes. That’s the one.
I like this module and find it very useful.
I’ll try to force it then.

1 Like

I tried this (with some artifical help)
There were 2 issues during install, and 2 errors in the browser after.
I think it is working for me now on farmOS 4.0.2

Patch is attached if some wants to fix it.

"Tested farm_template 1.0.0-alpha3 on farmOS 4.0.2 by manually bumping core_version_requirement to ^10 || ^11. Found the following incompatibilities

  1. Fatal error on module install — Template.php’s quick form plugin redeclares $entityTypeManager/$currentUser as untyped properties. In farmOS 4, farm_quick’s QuickFormBase now declares these as typed, constructor-promoted
    properties, so the redeclaration causes:
    Fatal error: Type of Drupal\farm_template\Plugin\QuickForm\Template::$entityTypeManager must be Drupal\Core\Entity\EntityTypeManagerInterface (as in class Drupal\farm_quick\Plugin\QuickForm\QuickFormBase)
  2. Fatal error rendering template pages — Element/Quantity.php and Plugin/Template/Widget/Quantity.php call the global function quantity_measure_options(), which was removed in farmOS 4. It’s replaced by
    Drupal\quantity\QuantityHelper::quantityMeasureOptions().
  3. PHP 8.4 deprecations — RecordTemplateController::asset()/log() and TemplateForm::access()/buildForm() use implicitly-nullable typed parameters (Type $x = NULL), deprecated in PHP 8.4. Fixed to explicit ?Type $x = NULL.
  4. composer.json’s farmos/farmos constraint (^3.0) and farm_template.info.yml’s core_version_requirement (^10) need widening to ^3.0 || ^4.0 and ^10 || ^11 respectively.

"

farm_template-d11-farmos4-compat-patch.txt (5.5 KB)

1 Like

Nice. Sounds like you found the major issues! The next step would be to open a issue + merge request in the upstream module for @paul121 to review/merge.