CakePHP 3.0 - 帮助者 - 来自字段定义的表单标签

时间:2016-03-08 16:06:56

标签: forms cakephp cakephp-3.0 helper

有没有办法让CakePHP bake命令将字段描述(因为它在数据库中)分配为表单的标签?

例如,如果表定义如下:

  if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {
        Window w = getWindow();
        w.setFlags(
                WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION,
                     WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
             w.setFlags(
                    WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
                   WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
             SystemBarTintManager systemBarTintManager = new         SystemBarTintManager(this);
            systemBarTintManager.setStatusBarTintEnabled(true);
            systemBarTintManager.setStatusBarTintColor(Color.parseColor("#689F38"));

    }

然后在表格的标签中将是“描述”和“代码”。

默认情况下,bake命令将它们设为“equ_desc”和“equ_code”。

1 个答案:

答案 0 :(得分:1)

我不相信这是可能的烘烤,因为它听起来像一个相当定制的情况(有人纠正我,如果我错了)。但是,您可以更改已烘焙的表单并覆盖使用表单输入上的label选项生成的标签,如下所示: -

<?= $this->Form->input('equ_desc', ['label' => __('Description')]) ?>

这会为您提供所需的标签。

相关问题