# Custom CakePHP bake form elements

**URL:** <https://discourse.cakephp.org/t/custom-cakephp-bake-form-elements/8301>\
**Category:** Need Help\
**Created:** [August 28, 2020, 9:29am UTC](https://discourse.cakephp.org/t/custom-cakephp-bake-form-elements/8301 "2020-08-28T09:29:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dantedantas](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/dantedantas/32/1770_2.png) [@dantedantas](https://discourse.cakephp.org/u/dantedantas)\
**Post date:** [August 28, 2020, 9:29am UTC](https://discourse.cakephp.org/t/custom-cakephp-bake-form-elements/8301/1 "2020-08-28T09:29:55Z")

</div>

Hello,

Please, I need a help with the bake customisation. Probably is something basic, but I was not able to find out this information/explanation.

I am using BAKE to create the basic CRUD and then, I am doing some custom. I would like to know where and how to change (for e.g.) the add.php view (template).

On the sourcefile I have the from with the code:

```
echo $this->Form->control('fkconid');

```

If I open this (add.php) page and go to look the generated code, I have:

```
<div class="input number required">
<label for="fkconid">Fkconid</label>
<input type="number" name="fkconid" required="required" data-validity-message="This field cannot be left empty" oninvalid="this.setCustomValidity(&#039;&#039;); if (!this.value) this.setCustomValidity(this.dataset.validityMessage)" oninput="this.setCustomValidity(&#039;&#039;)" id="fkconid" value="1"/>
</div>

```

I would like to customise the form code above. Please, could someone help me?  
P.S.: I also will need to customise the layout page as I am using the AdminLTE3.

My environment:  
CakePHP 4.0.3  
PHP 7.2.4  
AdminLTE 3

---

<div class="post-metadata">

**Author:** ![Jawfin](https://avatars.discourse-cdn.com/v4/letter/j/dbc845/32.png) [@Jawfin](https://discourse.cakephp.org/u/Jawfin)\
**Post date:** [August 29, 2020, 1:54pm UTC](https://discourse.cakephp.org/t/custom-cakephp-bake-form-elements/8301/2 "2020-08-29T13:54:42Z")

</div>

As you didn’t say what you want customised I’ll have a guess.

So say you want the text in the label and the text hint changed, you can do: -

```auto
echo $this->Form->control('fkconid', ['label' => __('Your Con ID:'), 'placeholder' =>__('Enter ID here')]);

```

Whatever properties belong to the generated fields can be overwritten with that named array.  
And any style changes should be handled with your CSS - don’t go sneaking style tags in here!

Cheers

---

<div class="post-metadata">

**Author:** ![dreamingmind](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/dreamingmind/32/1857_2.png) [@dreamingmind](https://discourse.cakephp.org/u/dreamingmind)\
**Post date:** [September 1, 2020, 3:12pm UTC](https://discourse.cakephp.org/t/custom-cakephp-bake-form-elements/8301/3 "2020-09-01T15:12:51Z")

</div>

[Here are the details](https://book.cakephp.org/4/en/views/helpers/form.html#options-for-control) of what you can change using the `options` array described by @Jawfin.

[Here is a description](https://book.cakephp.org/4/en/views/helpers/form.html#customizing-the-templates-formhelper-uses) of how to change the structure of the final output beyond what that allows.
