\ZenFields
Provides shortcuts to adding fields to the main tab.
Usage:
<code>
$fields->text("MyField");
// Result: $fields->addFieldToTab("Root.Main", TextField::create("MyField", "My Field"));
$fields->dropdown("MyField", "My label", $source);
// Result: $fields->addFieldToTab("Root.Main", DropdownField::create("MyField", "My label", $source));
</code>
Method names are defined by the FormField class, without the "Field" suffix removed, with a lowercase first letter.
e.g.
CurrencyField -> currency()
TreeDropdownField -> treeDropdown()
- Author: Uncle Cheese <unclecheese@leftandmain.com>
Synopsis
class ZenFields
extends Extension
{
- // methods
- public FieldList __call()
- public void add()
- public void addField()
- public FieldList tab()
- public FieldList imageUpload()
- public FieldList hasManyGrid()
- public FormField field()
- public FormField configure()
- public FieldList removeField()
- public FieldGroup group()
- public array allMethodNames()
Hierarchy
Extends
- Extension
Members
protected
- $field — FormField
- $tab — string
Methods
public
- __call() — A wildcard method for accepting any FormField object as a method.
- add() — Adds a FormField to the FieldList
- addField()
- allMethodNames() — Defines all possible methods for this class. Used to support wildcard methods
- configure() — Gets the most recently added FormField
- field() — Gets a specific field, or the most recently added field Note: Accessing a FormField object is deprecated as field() conflicts with FormField::Field().
- group() — Adds a FieldGroup to the FieldList
- hasManyGrid() — A shortcut for creating a {@link GridField} configured for a simple has_many relation
- imageUpload() — A shortcut for creating an {@link UploadField} configured for images
- removeField() — A shortcut that makes FieldList::removeByName() chainable
- tab() — Sets the current tab