Kit reference¶
Every kit page follows the same template: purpose, factory method, Form API
#type, setters (with the trait each one comes from), a minimal example, and
the render array that example generates. The generated arrays were produced by
running each example against the code in src/; t('...') stands for a
TranslatableMarkup object.
Base classes¶
FormFactoryKit(src/Kits/FormFactoryKit.php) is the abstract base of every kit here. It extendsDrupal\kits\Kitand adds the Form API key constants (TITLE_KEY,REQUIRED_KEY, ...), the static$typeand$titledefaults,getArray(),getType(),attach($item, $type = 'library')andsetChildrenGrouped(). It implementsFormFactoryKitInterface(src/Kits/FormFactoryKitInterface.php).FieldKit(src/Kits/Field/FieldKit.php) is the abstract base of input kits. It addsValueTrait,PrefixTraitandSuffixTrait.
Every kit also inherits these methods from Drupal\kits\Kit, which are not
repeated on each page: append($kit), set($key, $value),
get($key, $default), has($key), setContext($key, $value),
getContext($key, $default), setID($id), getID(), setGroup($group),
excludeParameter($name), getArray() and getChildrenArray().
set('anything', $value) writes #anything, so any Form API property
without a dedicated setter is still available.
All kits¶
| Kit | Factory method | #type |
Page |
|---|---|---|---|
ButtonKit |
button() |
button |
Button kits |
SubmitButtonKit |
submit() |
submit |
Button kits |
ImageButtonKit |
imageButton() |
image_button |
Button kits |
ContainerKit |
container() |
container |
Container kits |
DetailsKit |
details() |
details |
Container kits |
VerticalTabsKit |
verticalTabs() |
vertical_tabs |
Container kits |
TabKit |
— | details |
Container kits |
TableKit |
table() |
table |
Container kits |
TableRowKit |
tableRow() |
— | Container kits |
TextFieldKit |
textField() |
textfield |
Text and number field kits |
TextAreaKit |
textArea() |
textarea |
Text and number field kits |
EmailKit |
email() |
email |
Text and number field kits |
PasswordKit |
password() |
password |
Text and number field kits |
PasswordConfirmKit |
passwordConfirm() |
password_confirm |
Text and number field kits |
PathKit |
path() |
path |
Text and number field kits |
SearchKit |
search() |
search |
Text and number field kits |
UrlKit |
url() |
url |
Text and number field kits |
NumberKit |
number() |
number |
Text and number field kits |
RangeKit |
range() |
range |
Text and number field kits |
TelephoneKit |
telephone() |
tel |
Text and number field kits |
CheckboxKit |
checkbox() |
checkbox |
Choice field kits |
CheckboxesKit |
checkboxes() |
checkboxes |
Choice field kits |
RadiosKit |
radios() |
radios |
Choice field kits |
SelectKit |
select() |
select |
Choice field kits |
TableSelectKit |
tableSelect() |
tableselect |
Choice field kits |
OptionKit |
— | — | Choice field kits |
DateKit |
date() |
date |
Date and color field kits |
DateListKit |
dateList() |
datelist |
Date and color field kits |
DateTimeKit |
dateTime() |
datetime |
Date and color field kits |
ColorKit |
color() |
color |
Date and color field kits |
EntityAutoCompleteKit |
— | entity_autocomplete |
Entity field kits |
NodeAutoCompleteKit |
nodeAutoComplete() |
entity_autocomplete |
Entity field kits |
UserAutoCompleteKit |
userAutoComplete() |
entity_autocomplete |
Entity field kits |
TaxonomyTermAutoCompleteKit |
taxonomyTermAutoComplete() |
entity_autocomplete |
Entity field kits |
TaxonomyTermSelectKit |
taxonomyTermSelect() |
select |
Entity field kits |
Media\FileKit |
fileUnmanaged() |
file |
File and image field kits |
ManagedFile\FileKit |
file() (currently fails, see page) |
managed_file |
File and image field kits |
ImageKit |
image() |
managed_file |
File and image field kits |
UploadValidatorKit |
uploadValidator() |
— | File and image field kits |
FileSizeUploadValidatorKit |
— | — | File and image field kits |
ImageExtensionUploadValidatorKit |
— | — | File and image field kits |
ImageResolutionUploadValidatorKit |
— | — | File and image field kits |
HiddenKit |
hidden() |
hidden |
Hidden and value kits |
ValueKit |
value() |
value |
Hidden and value kits |
MarkupKit |
markup() |
markup |
Markup kits |
TextKit |
text() |
markup |
Markup kits |
HeadingKit |
heading() |
markup |
Markup kits |
ItemKit |
item() |
— | Markup kits |
TemplateKit |
template() |
inline_template |
Markup kits |
ExampleKit |
example() |
inline_template |
Markup kits |