Issue

When building the renderable array we should not be unsetting the `#theme` variable and we should not be making assumptions that `#markup` or the `#text` variables exist in the render array.

This leads to the following notice being thrown:

"Notice: Undefined index: #text in _addtocalendar_preprocess_field() (line 191 of [..]/addtocalendar/includes/addtocalendar.build.inc)"

This also leads to inconsistencies in where the add to calendar button is displayed (before or after). The following screenshot is 4 different date types of Date and Daterange fields with the same AddtoCalendar settings. As you can see the placement of the button is inconsistent"

Inconsistent AddToCalendar placement

Proposal:

We should be using `#suffix` variable in the render array to place the AddtoCalendar button after the date is rendered.

Comments

chrissnyder created an issue. See original summary.

chrissnyder’s picture

The attached patch should correct this issue and the notices thrown by leveraging the `#suffix` variable in the render array.

chrissnyder’s picture

Status: Active » Needs review
chrissnyder’s picture

Note: The patches in this issue and #2878558: Notice thrown when not using a mulitvalued date field. overlap. So depending on which one gets applied first the other may have to be re-rolled.

gg24’s picture

Assigned: Unassigned » gg24
gg24’s picture

Assigned: gg24 » Unassigned
Status: Needs review » Reviewed & tested by the community

Patch works as intended. Issuing RTBC.

Thanks!

  • gg24 committed 980e013 on 8.x-2.x authored by chrissnyder
    Issue #2878572 by chrissnyder, gg24: AddToCalendar rendering is...
gg24’s picture

Status: Reviewed & tested by the community » Fixed

Fixing this issue to 8.x-2.x-dev branch!

Status: Fixed » Closed (fixed)

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