Skip to content

$page->if() returns as callable if Page object is passed as "yes" parameter. #2057

Closed
@elabx

Description

@elabx

It called to my attention that when trying to pass a Page object as a "yes" value, I was ending up with the page title as a result of the if(). Sample of the code I was trying to do, basically to add some dynamic values in a template used for rendering an email body.

$body = $this->files->render('mails/mjml/autoresponse.php', [
          'listado_page' => $this->page->if("template=listado|desarrollo|privada",  $this->page ),
]);

So I ended up discovering that the Page object evaluates to true in this is_callable() call in PageComparison.php.

So, I think it would be more helpful to actually expect the Page object as a value?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions