Problem/Motivation

We have a special form at /farm/settings/modules that allows users with permission to enable farmOS modules. This provides a simpler UI than Drupal's core /admin/modules, with a more limited set of options, and it's own dedicated permission.

However, this currently uses a hard-coded list of modules that are included with farmOS core: https://github.com/farmOS/farmOS/blob/ddff82052a8d522752c1de4d7ed529b55e...

This means that contrib farmOS modules will not appear in this list, even if they are present in the filesystem.

Proposed resolution

TBD

Remaining tasks

TBD

User interface changes

TBD

API changes

TBD

Data model changes

TBD

Issue fork farm-3220609

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

m.stenta created an issue. See original summary.

m.stenta’s picture

Issue tags: +beta blocker

paul121 made their first commit to this issue’s fork.

paul121’s picture

This simply adds separate Core and Contrib details elements with checkboxes for each. A minor improvement is that the submit button is disabled until an uninstalled module becomes checked.

I only included the module name, but it might be nice to include descriptions for contrib modules too? Even a link? Maybe this can be a follow up.

I didn't add any tests for this, mostly because we don't have any existing tests for this form. Would it be good to add some?

paul121’s picture

Status: Active » Needs review
paul121’s picture

Okay, I added functional javascript tests that should cover everything that happens in this module settings form - user permissions, module installation, and form #states behavior.

paul121’s picture

The javascript tests are dependent on the changes in this PR: https://github.com/farmOS/farmOS/pull/437

  • m.stenta committed 782cc6d on 2.x
    Issue #3220609 by paul121: Add a mechanism for detecting/displaying...
m.stenta’s picture

Status: Needs review » Fixed

Perfect! Thanks @paul121!

I added a few small commits to the end and merged it.

Quick summary of my changes:

  • Added a docblock for FarmSettingsModulesForm::moduleOptions() since {@inheritdoc} no longer applies.
  • Removed disabled logic from FarmModulesForm (no longer needed).
  • Changed "Contrib modules" to "Community modules" in the UI.
  • Moved modules field descriptions to hook_help() text at the top of the page.
  • Prevent rendering the "Community modules" box entirely if there are no modules.

My motivation for the last two were mainly aimed at simplifying translateable text, so they wouldn't need to include the @type placeholder, which would be replaced with "core" or "contrib". I'd rather use the word "Community" instead of "Contrib" because it's less Drupal-y. :-)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.