PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, January 1, 2022

[FIXED] What is Bake.columnData in twig template files

 January 01, 2022     cakephp, cakephp-3.0, twig     No comments   

Issue

In the following statement, what is Bake.columnData? This was part of the bake template form.twig.

Where can I find more information of what attributes and methods are available? I'm essentially trying to see what fieldData contains.

{%- set fieldData = Bake.columnData(field, schema) %}

Solution

Bake is a twig style reference to $this->Bake, which is a helper, \Bake\View\Helper\BakeHelper, so Bake.columnData() is basically $this->Bake->columnData().

There's no docs about that specifically, the plugin's Cookbook only describes Twig usage in general, so you'll have to dig through the source code I'm afraid.

It should be noted that Bake uses wyrihaximus/twig-view, you can find more information there about its CakePHP specific features. For debugging purposes there's for example the debug filter (which maps to CakePHP's debug() function), which you could use like this this in your twig template:

{% do Bake.columnData(field, schema)|debug %}

This will dump the debug output in the generated template file, and will look something like:

\vendor\twig\twig\src\Environment.php(418) : eval()'d code (line 103)
########## DEBUG ##########
[
    'type' => 'string',
    'length' => (int) 255,
    'null' => false,
    'default' => null,
    'collate' => 'utf8_general_ci',
    'comment' => '',
    'precision' => null
]
###########################


Answered By - ndm
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing