Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
The following code:
// Render title for the admin preview.
if (!empty($view->live_preview)) {
$variables['title']['#markup'] = $view->getTitle();
}
causes:
exception: [Warning] Line 137 of core/modules/views_ui/views_ui.module:
Illegal string offset '#markup'
Proposed resolution
In PHP 7.1 a warning is raised if you suddenly treat a string as an array.
Remaining tasks
User interface changes
None
API changes
None
Data model changes
None
Comment | File | Size | Author |
---|---|---|---|
#2 | 2842763-2.patch | 599 bytes | alexpott |
Comments
Comment #2
alexpottYou can run
Drupal\views_ui\Tests\SettingsTest
on 7.1 to see this fail. This test passes with the attached patch.Comment #3
alexpottComment #4
cilefen CreditAttribution: cilefen as a volunteer commentedI verified on 7.1 as described.
Comment #7
catchCommitted/pushed to 8.3.x and cherry-picked to 8.2.x. Thanks!