faithcatholic / mass_times
Mass Times entity.
Package info
github.com/FaithCatholic/mass_times
Language:Shell
Type:drupal-module
pkg:composer/faithcatholic/mass_times
Requires
None
Requires (Dev)
- drupal/address: *
- drupal/devel: *
- drupal/field_group: *
- drush/drush: *
- faithcatholic/diocesan_directory: dev-master
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Defines a mass_times content entity for recording the service times of a
parish: a name, a publishing status, an owner, and a set of shipped field
storages for the parish, day of week, service type, start and end time,
language, service id and a comment. Entities are managed under
/admin/structure/mass_times and listed in an admin view at
/admin/manage/masstimes. There is no front-end output; other modules or the
site theme are expected to display the data.
Requirements
Drupal 10.3+ or 11, plus the following modules, all declared in the info.yml:
- Diocesan Directory
(custom, not on drupal.org):
field_parishis an entity reference to itsdirectoryentity. Installing it pulls in Address and Field Group. - Core Field, Options, User and Views.
The module also assumes config that no module provides. These are the things that break a fresh install:
- The roles
administrator,diocesan_administratoranddirectorymust exist. The shipped admin view (views.view.admin_masstimes) depends on them for access and the install fails without them. - Only field storages ship in
config/install. The field instances (field.field.mass_times.mass_times.*), form display and view display are expected to come from the site's config sync. On a bare site the entity form shows only the base fields and the admin view columns are empty until those are created.
Installation
Install as usual at /admin/extend, or drush en mass_times. If the install
fails on missing config dependencies, create the three roles above first.
Usage
/admin/structure/mass_times: collection of Mass times entities with add, edit and delete. Also linked from Content as "Mass Times", which points at the admin view./admin/structure/mass_times/settings: settings tab and the Field UI base route, so Manage fields and Manage display live here. The settings form itself has no options./admin/manage/masstimes: the "MassTimes Manager" view, restricted by role toadministrator,diocesan_administratoranddirectory.- Help text at
/admin/help/mass_times.
Permissions, all defined by the module: add, edit, delete, view published and view unpublished mass times entities, access the overview page, and administer mass times entities (the admin permission, restricted).
Development
The repo carries a DDEV setup based on ddev-drupal-contrib, drupal-contrib-extras, ddev-drupal and pimp-my-shell.
ddev startruns the bootstrap:poserfetches core and the dev dependencies fromcomposer.json, installs the site, creates the two custom roles, enablesdevelandmass_times(which pulls in the Diocesan Directory chain) and prints adrush ulilink. Admin credentials areadmin/1.web/andvendor/are ignored; the module is symlinked file by file intoweb/modules/custom/mass_times. After adding or deleting a top-level file, runddev symlink-projectso the container sees it.ddev phpcsandddev phpcbfuse the Drupal ruleset fromphpcs.xml.dist.ddev phpstan --level=6 -c ../../../../phpstan.neonruns PHPStan with the repo config. Plainddev phpstandoes not, because the add-on symlinksphpstan.neoninto the module directory with a broken relative path and falls back to level 0 with no ignores.
Notes
- The entity annotation still uses
@ContentEntityType; converting it to a PHP attribute is pending and will be required before Drupal 12. hook_help()lives insrc/Hook/MassTimesHooks.php. The procedural stub inmass_times.moduleonly exists for Drupal 10 and can be dropped once the floor is 11.1.MassTimes::getOwnerId()returns an int asEntityOwnerInterfacedocuments; on loaded entities the raw field value is a numeric string, so code comparing the result with===against a string id would need adjusting.