studiometa / create-wordpress-project

A generator to kickstart your WordPress project in a few seconds! ⚡
MIT License
6 stars 3 forks source link

Create ACF fields via CLI #86

Closed ptt-homme closed 2 years ago

ptt-homme commented 3 years ago

As discussed, it would be nice to find a solution to generate ACF fields config files using CLI as provided by Symfony or Laravel. The goal : generate PHP files config containing all fields for a CPT or a taxonomy. The cli asks what kind of content, what field type, the name of the field, custom values and write the answer in a file. We should have a look if this mechanism exists on the WordPress world or make a little bit of R&D to have a Meta solution that fullfields this. @studiometa/wordpress What's your take on that?

perruche commented 3 years ago

Basic classification for fields type

Most used fields

Rest of the fields Checkbox, Radio Button, Select, True / False, Range, Text Area, Button Group, File, oEmbed, Color Picker, Date Picker, Date Time Picker, Google Map, Time Picker, Accordion, Flexible Content, Tab, Clone, Post Object, Taxonomy, User

titouanmathis commented 3 years ago

ACF Composer has a console command to generate a Field class: https://github.com/Log1x/acf-composer/blob/master/src/Console/FieldMakeCommand.php

perruche commented 3 years ago

The goal of this command would be to do more than just generating a file with a base structure. Adding prompts to allow user to add fields in the command. Kinda like drupal does for drupal generate:plugin:block see

To speed up even more the creation of the field groups


I did some research this morning, and i haven't found informations that this is possible to do with symfony console. I'm not sure it's possible to add prompts. Maybe @lusimeon you have done something linke this before ?

lusimeon commented 3 years ago

@perruche You can do prompt on Symfony command thanks to question helper include in command component.

perruche commented 2 years ago

A tool is being made to handle this issue: https://github.com/studiometa/merlin