Skip to content

Fix for PHP 5.3 support #8

Description

@engram-design

I'm aware the plugin has only been tested on 5.5, and developing locally with 5.4 works a treat. Our development server runs 5.3.29, and runs across an error in fieldtypes/ButtonBox_TextSizeFieldType.php and fieldtypes/ButtonBox_ColoursFieldType.php

Basically, It just doesn't like the direct calling method when referencing an array index (why this was never supported a long time ago is beyond me).

Up to you if you wish to add official support for this, and in case anyone else needs a fix for this issue:

protected function getDefaultValue()
{
    foreach ($this->getOptions() as $option)
    {
        if ( !empty($option['default']) )
        {
            return $option['value'];
        }
    }
    return $this->getOptions()[0]['value'];
}
protected function getDefaultValue()
{
    $options = $this->getOptions();

    foreach ($options as $option)
    {
        if ( !empty($option['default']) )
        {
            return $option['value'];
        }
    }
    return $options[0]['value'];
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions