Bug #23041 Bug Fixed

Conditionals for Toggle fieldtype do not work as outlined in documentation

Version: 3.5.4 Reporter: Reusser Design, LLC

This is an archived bug report. If you are experiencing a similar issue, upgrade to the latest release and if that does not solve the problem, submit a new bug report

The conditional according to the documentation:

{if toggle_field}
  Yes
{if:else}
  No
{/if}

However, using this format will output “Yes” at all times. To correctly test for this fieldtype, it’s necessary to check if the field is equal to 1:

{if toggle_field == 1}
  Yes
{if:else}
  No
{/if}
  • In system/ee/EllisLab/Addons/toggle/ft.toggle.php, add the following method:

    public function replace_tag($data, $params = array(), $tagdata = FALSE)
    {
        // force loose type / improper type from the DB to always be 0/1
        return (int) $data;
    }
.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases