folbert / fewbricks

Write code to create ACF field groups, fields and re-usable modules.
https://fewbricks2.folbert.com
GNU General Public License v3.0
124 stars 12 forks source link

Should Fewbricks2 implement a fluent interface? #41

Closed folbert closed 6 years ago

folbert commented 6 years ago

To make it possible to do something like

$text_field = (new Select())
    ->setRequired(true)
    ->setChoices(
    [
        'option1' => 'Option 1',
        'option2' => 'Option 2'
    ]
  );
folbert commented 6 years ago

Yes. For functions used for setting ACF settings, it makes sense to make them chainable to make it easier to create fields and to require less code for creating fields and adding them to field groups.