faithcatholic / diocesan_directory
Diocesan parishes, schools, agencies, etc...
Package info
github.com/FaithCatholic/diocesan_directory
Type:drupal-module
pkg:composer/faithcatholic/diocesan_directory
Requires
- drupal/field_group: ^3.0 || ^4.0
Requires (Dev)
- drupal/address: *
- drupal/devel: *
- drupal/field_group: *
- drush/drush: *
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Provides a directory content entity for the organisations a diocese wants to
publish: parishes, schools, agencies and cemeteries. Each of those is a bundle
(a "Directory category", itself a directory_type config entity) with its own
fields for name, addresses, phone, fax, email, website, county, year
established, parent and child organisations, and a few bundle-specific ones
such as church type, rite, languages and grades. Entries are revisionable and
translatable, have a published flag, an owner, a public page at
/directory/{id} and an admin listing under Content.
Requirements
Drupal 10.3+ or 11, plus:
- Address
- Field Group
- Core Link, Telephone, Text, Options, User and Node.
The shipped admin_directory view restricts access by role and therefore
depends on three roles existing on the site before the module is installed:
administrator, diocesan_administrator and directory. On a fresh site
only administrator exists, and enabling the module fails with an unmet
config dependency until the other two are created. The role labels do not
matter, only the machine names.
Installation
Install as usual at /admin/extend. If it refuses with a dependency error,
create the diocesan_administrator and directory roles first (for example
drush role:create diocesan_administrator 'Diocesan Administrator' and
drush role:create directory 'Directory'), then install again.
Installation creates the four categories (agencies, cemeteries, parishes, schools), their field storage, field instances, form and view displays, and the admin view.
Usage
- Directory listings: /admin/manage/directory (the view, also linked as "Directory listings" under Content). The plain entity list is at /admin/content/directory.
- Add an entry: /admin/content/directory/add, or one of the category links in the admin menu. Edit, delete and revisions live under /admin/content/directory/{id}/.
- Categories and their fields: /admin/structure/directory_type (Field UI is enabled per category). Creating a category creates an empty bundle; the fields shipped with the module are only attached to the four default categories.
- Public page: /directory/{id}, rendered by
templates/directory.html.twigwith the usual suggestions (directory--{bundle},directory--{id},directory--{bundle}--{view-mode}and so on). - Permissions: the module defines its own set under "Diocesan Directory", covering add, edit, delete, view published, view unpublished, access to the overview, and viewing, reverting and deleting revisions. "Administer Directory entities" grants all of it. Managing categories uses the core "Administer site configuration" permission.
- The name field on parish forms is widened to 255 characters by
hook_form_alter(); every other bundle uses the field's own limit.
Development
The repository ships a DDEV setup based on ddev-drupal-contrib with the drupal-contrib-extras, pimp-my-shell and ddev-drupal add-ons.
ddev startruns the bootstrap on first start:poserbuilds a Drupal 11 project inweb/andvendor/(both git-ignored), installs the site, symlinks this module intoweb/modules/custom/diocesan_directory, creates the two roles the view needs and enables the module with its dependencies. Every start prints a one-time login link; the account isadminwith password1.ddev phpcsandddev phpcbfuse the Drupal ruleset inphpcs.xml.dist.ddev phpstan --level=6 -c ../../../../phpstan.neonis the static analysis command to use. Plainddev phpstandoes not pick up the repository'sphpstan.neon, because the add-on symlinks it into the module directory with a broken relative path, so it runs at level 0 with no ignores and reportsnew static()noise.
Known issues and notes
DefaultEntitySettingsFormis referenced byDefaultEntityHtmlRouteProvider::getSettingsFormRoute(), but that method only registers thedirectory.settingsroute for entity types without a bundle entity type. Because thedirectoryentity declaresbundle_entity_type = "directory_type", the route is never added and the form is unreachable. It is kept in case a settings route is wanted later.- The two entity types still use
@ContentEntityTypeand@ConfigEntityTypeannotations. They should move to PHP attributes before Drupal 12. - The procedural functions in
diocesan_directory.moduleonly exist so the hooks still fire on Drupal 10. Once the minimum is Drupal 11.1 they can be deleted;src/Hook/DiocesanDirectoryHooks.phpis the implementation. DefaultEntityRevisionRevertForm::getDescription()returns an empty string where the interface documentsTranslatableMarkup. Core's own node form does the same; phpstan reports it at level 6 and it is left as is.