PHP warning when viewing a registrant without first / last name fields

Created on 26 July 2024, 9 months ago

Problem/Motivation

When viewing a registrant that doesn't have a first name or last name field, the following warning is emitted:

Warning: Attempt to read property "value" on null in Drupal\recurring_events_registration\Controller\RegistrantController->getTitle() (line 118 of modules/contrib/recurring_events/modules/recurring_events_registration/src/Controller/RegistrantController.php).

Steps to reproduce

  1. Create a registrant type that does not have a first name or last name field. As an example: a site might host events intended for classes of school children. Requiring a first or last name doesn't make sense in this context.
  2. Register for an event.
  3. View the registrant in the backend/

Proposed resolution

Instead of hardcoding a title that assumes the optional field_first_name and field_last_name fields are always going to be retained by all users, let's just display the label. This is configurable by the site builder in the Registrant Settings under Registrant Display > Registrant Title.

User interface changes

In sites that use default settings, the title of the registrant page will change from "first name + last name" to the email address. This change is probably not going to have much impact for most users and now respects the title as configured by the site builder.

🐛 Bug report
Status

Active

Version

2.0

Component

Recurring Events Registration (Submodule)

Created by

🇧🇬Bulgaria pfrenssen Sofia

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024