loading...

CakePHP Form button Customize

sachikokame profile image sachiko ・1 min read

how to

  • Add the class you want to adapt to create
<?= $this->Form->create(null, ['class'=> 'aaa' , 'url' => ['controller' => 'Advices', 'action' => 'heart']]); ?>
<?= $this->Form->hidden( 'advice_id', ['value'=>$advices->id ]); ?>
<?= $this->Form->button(__('Heart')) ?>
<?= $this->Form->end() ?>
  • How to write on the button of the class
.aaa .button, .aaa button, .aaa input[type='button'], .aaa input[type='reset'], .aaa input[type='submit'] .aaa {
    background-color: #db116c;
    border: 0.1rem solid #db116c;
}
  • Appearance after change

Appearance after change


A little more

  • Image of unpressed heart
<?= $this->Form->button(__('♡')) ?>
.aaa .button, .aaa button, .aaa input[type='button'], .aaa input[type='reset'], .aaa input[type='submit'] .aaa {
    background-color: #f1f2f4;
    border: 0.1rem solid #606c76;
    -moz-border-radius: 50%;
    -webkit-border-radius: 50%;
    border-radius: 50%;
    font-size: 2rem;
    color: #606c76;
}

Alt Text


  • Image of pressed heart
<?= $this->Form->button(__('♥')) ?>
.aaa .button, .aaa button, .aaa input[type='button'], .aaa input[type='reset'], .aaa input[type='submit'] .aaa {
    background-color: #db116c;
    border: 0.1rem solid #db116c;
    -moz-border-radius: 50%;
    -webkit-border-radius: 50%;
    border-radius: 50%;
    font-size: 2.3rem;
    color: white;
}

Alt Text


Posted on by:

sachikokame profile

sachiko

@sachikokame

I'm not good at English, but I will do my best to write it! Thank you. Japanese version dev.to↓ https://qiita.com/sachiko-kame twitter↓ https://twitter.com/854729

Discussion

pic
Editor guide
 

Cakephp is still a thing? It was my first php framework but I'm glad I made the switch.

 

Are you currently using a different framework?
A different framework is good too!

I want to use cakePHP! I'm using it because I thought!
I am writing an article hoping that there is the same person.

 

I used cakephp when it first came out. It was the php version of rails. I used to use rails so I was very excited. There were many issues back then, many missing documents and features. Then Symfony came out and I made the switch.

Thank you for your reply!

Sounds good!
It's a cool framework!
I want to use it someday!

There are various, but
I'm in love with the name cakePHP, so
I want to get along with cakePHP a little more!