We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum


Thread tagged as: Suggestions, Discussion

perch_layout_has function could use clarification

From the documentation, the perch_layout_has() function:

You can test to see if a layout variable has been set using perch_layout_has()

So I assumed i was able to validate if a boolean variable was set in the layout vars using this function. The problem is how perch determines if the layout variable is set.

        $var = $Perch->get_layout_var($var);
        if ($var) return true;
        return false;

if my set variable has a boolean value false, the function will return false even though the question asked "is the variable set" should return true because the variable is actually set, its value is false.

The function should either be returning the value of the isset() or array_key_exists() rather than returning the value.

Just a heads up for anyone no sure why their layout boolean variables are not working with perch_layout_has()

Jordin Brown

Jordin Brown 0 points

  • 6 months ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, the description should be:

You can test to see if a layout variable has been set and is truthy using perch_layout_has()