This module is for developers only. It does not provide any features for normal users.
OOP Forms module provides set of wrappers for building Drupal forms in a object oriented way.
It takes the burden of writing FAPI arrays manually off the developers and let them build those ugly arrays with set of method calls.
The old way:
$form['text_field'] = array(
'#type' => 'textfield',
'#title' => t('Old text field'),
'#default_value' => 'This is exhausting',
'#description' => t('Manually created text field using FAPI array.'),
);
The new OOP way:
// Get OOP Forms service for easier use
/** @var \Drupal\oop_forms\Form\Builder $builder */
$builder = \Drupal::service('oop_forms.builder');
$form['text_field'] = $builder
->createTextField()
->setTitle(t('OOP text field'))
->setDefaultValue('This is fun!')
->setDescription(t('Text field generated with OOP forms service'))
->build();
To add support for more FAPI elements, look for missing elements in Drupal\Core\Render\Element namespace
(its files are located at core/lib/Drupal/Core/Render/Element).
Supporting organizations:
Project information
Maintenance fixes only
Considered feature-complete by its maintainers.- Project categories: Developer tools
- Created by siliconmind on , updated
Stable releases for this project are covered by the security advisory policy.
There are currently no supported stable releases.
