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'];
}

Activity

  1. added 2 commits that reference this issue on Jan 29, 2015
    a3db2f1
    1582a52
  2. joshangell commented on Jan 29, 2015

    @joshangell

    Done! Thanks for the heads up and fix 😃

  3. engram-design commented on Jan 29, 2015

    @engram-design
    MemberAuthor

    No worries! Thank you for the awesome plugin - I use it all the time! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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