Search by

faithcatholic / custom_tweaks

nketchummjones

Various tweaks.

Package info

github.com/FaithCatholic/custom_tweaks

Language:Shell

Type:drupal-module

pkg:composer/faithcatholic/custom_tweaks

Statistics

Installs: 1 527

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v4.0 2026-09-10 00:55 UTC

README

A grab bag of site-specific adjustments for the Faith Catholic site. It has no settings form and no configuration of its own. Once enabled it silently changes personal contact mail, the action URL of two exposed filter forms, the time input on every date and time widget, and the buttons on node forms, and it adds one block, three field formatters and one route. Read the Usage section before enabling it, because most of what it does is invisible until it surprises you.

Requirements

Drupal 10.3 or newer, or Drupal 11.

These are declared in custom_tweaks.info.yml and Drupal installs them for you:

  • Field, for the field formatters and the date widget alter.
  • Datetime Range, for the two date range formatters.
  • Node, for the node form alter and the block cache tags.
  • Views, for the Resources block.
  • Recurring Dates Field, for the date recur start formatter. It also pulls in Datetime Range.

Not declared, because nothing breaks without them. The module adjusts these when present and does nothing when they are not:

  • Contact, for the personal contact form redirect and the mail rewrite. The /contact/success page is served by this module either way, but the redirect to it and the mail rewrite only ever fire for core's personal contact form.
  • AMP, whose extra node form buttons the module removes.
  • Acquia Search and Search API, whose exposed search fields get a placeholder.

The module also assumes site configuration that it does not ship. These are the things that bite on a fresh install:

  • A view with the machine name media_resources, with displays attachment_1, attachment_2 and attachment_3. The Resources block renders those three displays and nothing else. Without the view the block renders empty.
  • A view page at /resources whose exposed form is views_exposed_form__resources__page_1 and which takes a contextual filter as the third path segment. The form action rewrite only fires for that form.
  • A daterange field for the custom start and end formatters, and a date_recur field for the start formatter.

None of that configuration is enforced at install time, so check the list above first if a feature does not appear.

Installation

Install as usual at /admin/extend, or drush en custom_tweaks. The declared dependencies are installed with it.

Usage

There is nothing to configure. This is what the module does:

  • Personal contact form. Submissions are redirected to /contact/success, a page provided by this module that shows a thank you message. The route is custom_tweaks.contact_confirmation_default and it needs the access content permission.
  • Personal contact mail. The body of the contact_user_mail message is replaced with a greeting, a line naming the sender and the site, and the contact message rendered in its mail view mode. The original core body is discarded.
  • Date and time widgets. Every widget with a datetime element gets its HTML5 time input swapped for a plain text input, with the placeholder 04:30 PM and the description Format: 04:30 PM when the field has no description of its own. End dates get the same treatment. This applies to all date and time fields on the site, not a chosen list.
  • Node forms. The "Save and view AMP page" buttons are removed.
  • Exposed filter forms. On /resources the form action is rewritten to keep the contextual filter argument, which Views otherwise drops. On the Acquia Search and Search API forms the search box gets a Search placeholder.
  • Resources block. Place the block named "Resources" to render the three attachment displays of the media_resources view. It varies by route and is invalidated by the current node.
  • Field formatters. Three formatters are added: "Custom start time" and "Custom end time" for daterange fields, which show only one end of the range, and "Date recur start time formatter" for date_recur fields, which shows the start of each occurrence without the end.

Development

The repository is the module itself. DDEV builds a Drupal site around it, so web/ and vendor/ are ignored and the module is symlinked into web/modules/custom/custom_tweaks.

ddev start runs the bootstrap: it fetches core and dependencies with ddev poser, installs the site on first run with the admin password 1, symlinks the project into the docroot, enables devel, date_recur and custom_tweaks, and prints a one time login link. ddev drush uli gives you another link later.

Checks:

ddev phpcs
ddev phpcbf
ddev phpstan --level=6 -c ../../../../phpstan.neon

Pass -c explicitly. Plain ddev phpstan silently ignores the repository config, because the wrapper symlinks phpstan.neon into the module directory using a path that does not resolve in this layout. Without the config it runs at level 0 and skips the ignoreErrors entries.

DDEV add-ons in use: ddev-drupal-contrib, drupal-contrib-extras, pimp-my-shell and ddev-drupal.

Known issues and notes

  • The plugin classes still use annotations (@Block, @FieldFormatter) rather than PHP attributes. They need converting before Drupal 12.
  • The hooks live in src/Hook/CustomTweaksHooks.php. The procedural functions in custom_tweaks.module are thin #[LegacyHook] stubs kept only for Drupal 10, and can be deleted once the supported floor is Drupal 11.1.
  • The Resources block renders the view output into #markup, so cache metadata from the view does not bubble up and the markup is passed through Xss::filterAdmin(). Tags the view emits can be stripped.
  • The exposed form rewrite matches the literal paths /resources, /resources/all and /resources/%2A. It stops working if the view path or its aliases change.