DEV Community

sachiko-kame
sachiko-kame

Posted on

1

CakePHP Form button Customize

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() ?>
Enter fullscreen mode Exit fullscreen mode
  • 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;
}
Enter fullscreen mode Exit fullscreen mode
  • Appearance after change

Appearance after change


A little more

  • Image of unpressed heart
<?= $this->Form->button(__('♡')) ?>
Enter fullscreen mode Exit fullscreen mode
.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;
}
Enter fullscreen mode Exit fullscreen mode

Alt Text


  • Image of pressed heart
<?= $this->Form->button(__('♥')) ?>
Enter fullscreen mode Exit fullscreen mode
.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;
}
Enter fullscreen mode Exit fullscreen mode

Alt Text


Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

Top comments (4)

Collapse
 
yellow1912 profile image
yellow1912

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

Collapse
 
sachikokame profile image
sachiko-kame

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.

Collapse
 
yellow1912 profile image
yellow1912

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.

Thread Thread
 
sachikokame profile image
sachiko-kame

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!

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Engage with a sea of insights in this enlightening article, highly esteemed within the encouraging DEV Community. Programmers of every skill level are invited to participate and enrich our shared knowledge.

A simple "thank you" can uplift someone's spirits. Express your appreciation in the comments section!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found this useful? A brief thank you to the author can mean a lot.

Okay