0

I've created a plug-in, and inside that plug-in I've got a custom bake template. I'd like to create an Element file _head.ctp inside the /src/Template/Element/ folder when I execute the bake command.

The element file will consist of a code:

<div class="row">
    <div class="card-block">
        <a href="<?= $this->Url->build(array('action' => 'add', '_ext' => 'html')); ?>" class="btn btn-primary"><i class="icon-plus-circle2 position-left"></i> Add</a>&nbsp;&nbsp;&nbsp;
        <a href="<?= $this->Url->build(array('action' => 'index', '_ext' => 'html')); ?>" class="btn btn-primary"><i class="icon icon-grid2 position-left"></i> List All <?= __('{{ pluralHumanName }}') ?></a>
    </div>
</div>

Bake command which I'm using is: bin\cake bake all Customers --prefix backend --theme MyBakeTheme

NOTE: Once I'll execute this command my Element file _head.ctp should create inside the /src/Template/Element/Customer folder.

CakePHP v3.8.2 and Bake v1.x.

Can someone please assist in how I can create a custom Element file?

Thanks for your help.

user2136790
  • 61
  • 1
  • 2
  • 6
  • You'll probably have to provide some more information in order for someone to give a good answer. For example elaborate on what exactly this element file is used for, what exactly it contains (does is require access to variables, etc), and on what kind of bake task you'd need to create it. – ndm Oct 28 '20 at 16:09
  • Add more information with-in my initial message. – user2136790 Oct 28 '20 at 17:50
  • You have to create a Customer named folder inside Element then you should run this command. bin\cake bake all customers --prefix Foldername. – Cognisun Inc Mar 10 '21 at 05:44

0 Answers0