Problem/Motivation

Error location:
modules/contrib/simplelogin/simplelogin.module:228

The website encountered an unexpected error. Try again later. Error: Cannot use object of type Drupal\Core\Render\Markup as array in simplelogin_form_alter() (line 228 of modules/contrib/simplelogin/simplelogin.module). Drupal\Core\Extension\ModuleHandler->alter() (Line: 892) Drupal\Core\Form\FormBuilder->prepareForm() (Line: 249) Drupal\autosave_form\Form\AutosaveFormBuilder->prepareForm() (Line: 304) Drupal\Core\Form\FormBuilder->buildForm() (Line: 97) Drupal\autosave_form\Form\AutosaveFormBuilder->buildForm() (Line: 73)

Steps to reproduce

Enable the latest version: 7.1.3

Proposed resolution

Line no: 228

if (is_array($value) && isset($value['#type']) && in_array($value['#type'], $types)) {
          $title = $value['#title'] ?? '';

          // Convert Markup object to string safely
          if ($title instanceof \Drupal\Core\Render\Markup) {
            $title = $title->__toString();
          }

          $form[$key]['#attributes']["placeholder"] = $title;
          $form[$key]['#title_display'] = 'invisible';
          $form[$key]['#description'] = '';
        }

Comments

thirstysix created an issue. See original summary.

thirstysix’s picture

Patch file for D11, CMS

thirstysix’s picture

StatusFileSize
new1003 bytes

Updated #3 patch file