- Issue created by @promo-il
In block on click button Add Faq Item no reaction and in watchdog
TypeError: Cannot access offset of type string on string in Drupal\faq_block\Element\FaqFields::processFaqFields()
After apply patch
https://www.drupal.org/project/faq_block/issues/3300951#comment-15504017
📌
Typo in file,function name (FaqFileds.php)
RTBC
in
/src/Element/FaqFields.php (not /src/Element/FaqFileds.php))
$element['question'] = [
'#type' => 'textfield',
'#title' => t('FAQ Title'),
/*WTpatch: TypeError: Cannot access offset of type string on string in Drupal\faq_block\Element\FaqFileds::processFaqFileds()*/
'#default_value' => $element['#default_value']['question'] ?? '', //'#default_value' => $element['#default_value']['question'],
/*<<<*/
'#description' => t('Enter the FAQ heading. We can also enter the HTML tags on this field.<br><small><em>Set the title field empty or blank to delete the current FAQ item</em></small>'),
'#prefix' => '<div class="panel"><div class="panel__content">',
'#size' => '100'
];
$element['answer'] = [
'#id' => 'answer',
'#type' => 'text_format',
'#title' => t('FAQ Description'),
/*WTpatch: TypeError: Cannot access offset of type string on string in Drupal\faq_block\Element\FaqFileds::processFaqFileds()*/
//'#default_value' => ($element['#default_value']['answer'])?$element['#default_value']['answer']['value']:'',
'#default_value' => $element['#default_value']['answer']['value'] ?? '',
/*<<<*/
'#format' => (isset($element['#default_value']['answer']['format']))?$element['#default_value']['answer']['format']:'basic_html',
Active
2.0
Code