Cakephp Override HtmlHelper::link

前端 未结 7 1520
离开以前
离开以前 2021-01-06 18:42

I want to setup HtmlHelper::link() method so the default options array have escape = false.

How can I achieve this without changing the core class?

OBS: I al

7条回答
  •  情歌与酒
    2021-01-06 19:04

    I'm never comfortable overriding methods higher up in the hierarchy (ie in AppHelper) because there is always a good chance you break other helpers that are dependent.

    Hoping to be able to comment soon, instead of giving rubbish half answers!

    Also relevant: I heard that CakePHP 2.0 will allow helpers, components etc to be aliased. Eg you want to change the output from HtmlHelper, you can replace it with your own version without changing all your view templates.

提交回复
热议问题