-
Notifications
You must be signed in to change notification settings - Fork 7
Description
After running the Tocbot module through Coder upgrade, I couldn't enable Tocbot on a test site due to the following errors:
ParseError: syntax error, unexpected ''textfield'' (T_CONSTANT_ENCAPSED_STRING), expecting ']' in backdrop_load() (line 87 of /.../modules/tocbot/tocbot.module).
syntax error, unexpected ''textfield'' (T_CONSTANT_ENCAPSED_STRING), expecting ']'
Line 87 is the type textfield related one in this code part:
$form['moduleSettings']['tocbot_extrabodyclass'] =[
'#type' 'textfield'
Related code from the D7 module:
$form['moduleSettings']['tocbot_extrabodyclass'] = [
'#type' => 'textfield',
Coder upgrade strips the => between typeand textfield and the comma at the end of the line.
Also, according to @docwilmot in Gitter, Coder upgrade doesnt handle the square brackets syntax yet. At the moment a line like
$form['moduleSettings']['tocbot_extrabodyclass'] = [
has to be converted manually to:
$form['moduleSettings']['tocbot_extrabodyclass'] = array(
Note: The bracket syntax shouldn't be used because it's not available in PHP 5.3 (Backdrop supports 5.3).