hellomoto Posted April 3, 2017 Posted April 3, 2017 It's shorthand for creating new fields, templates, fieldgroups, and pages via the API. See bb for example usage.
kixe Posted April 3, 2017 Posted April 3, 2017 Module programming is great. Maybe I am missing something but currently I cannot see the benefit of your module. Example: Field creation with built-in API $f = new Field; $f->name = 'field_label'; $f->type = 'FieldtypeWhatever'; $f->tags = 'tag1 tag2'; $f->label = 'Field Label'; $f->columnWidth = 50; $f->save(); Field creation with your module $IS = new ImportShorthand(); $IS->newField([[ 'name' => 'field_label', 'type' => wire('modules')->get('FieldtypeWhatever'), 'tags' => 'tag1 tag2', 'label' => 'Field Label', 'columnWidth' => 50, ],[ // additional field options go here ]]);
Soma Posted April 3, 2017 Posted April 3, 2017 You can also do $f = new Field(); $f->setArray([ 'name' => 'field_label', 'type' => wire('modules')->get('FieldtypeWhatever'), 'tags' => 'tag1 tag2', 'label' => 'Field Label', 'columnWidth' => 50, ] ); 4
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now