Problem/Motivation

The office hours widget contains a field to add a comment per time slot. This field may not be applicable for every use case, so let's make it an option in the Field settings.

In the D7 version, the Comment is already made optional is the issue #2863233: Make the new 'Comment' per entry optional and opt-in

Proposed resolution

Make the 'Comment' value optional and opt-out per field instance.

Remaining tasks

  1. Write a patch
  2. Review
  3. Commit

User interface changes

The 'Comment' field per office hour is only available when enabled in the field instance configuration.

API changes

None.

Data model changes

None.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

idebr created an issue. See original summary.

idebr’s picture

Status: Active » Needs review
FileSize
4.63 KB

Attached patch implements a new field setting "Allow a comment per time slot" similar to the D7 implementation.

  • johnv committed d36ab55 on 8.x-1.x authored by idebr
    Issue #2888121 by idebr: Make Comment per time slot optional
    
johnv’s picture

Version: 8.x-1.x-dev » 8.x-1.0-alpha2
Status: Needs review » Fixed

Thanks.
Changed some more parts, and did not remove, but hide the Comment element.
Regards from Utrecht :-)

johannijdam’s picture

I found out that I get a warning when I'm saving a office hours field, like
Notice: Undefined offset: 0 in Drupal\office_hours\Plugin\Field\FieldType\OfficeHoursItemList->compressSlots() (line 183 of modules/contrib/office_hours/src/Plugin/Field/FieldType/OfficeHoursItemList.php).

I fixed it changing the OfficeHoursItemList.php:181
if (is_array($info['slots']) && !empty($info['slots'])) {
instead of
if (is_array($info['slots'])) {

johannijdam’s picture

Please see my patch attached

johannijdam’s picture

Status: Fixed » Needs review
Martijn de Wit’s picture

Category: Feature request » Bug report

  • johnv committed ad08e44 on 8.x-1.x authored by johannijdam
    Issue #2888121 by johannijdam, idebr: Make the Comment textfield per...
johnv’s picture

Category: Bug report » Feature request
Status: Needs review » Fixed

Thanks.

Status: Fixed » Closed (fixed)

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