Comments (3)
Hi @bogal
I think that this test case should help you : https://github.com/neilime/twbs-helper-module/blob/master/tests/TestSuite/TwbsHelper/Form/View/Helper/FormTest.php#L32
from twbs-helper-module.
I usually use __construct for this. Almost like in this example: https://docs.laminas.dev/laminas-form/quick-start/#factory-backed-form-extension
But I do not bend the constructor and use the same signature. This works perfectly for me:
class MyForm extends Form
{
/**
* Constructor
*
* @param null|int|string $name Optional name for the element
* @param array $options Optional options for the element
*/
public function __construct($name = null, $options = [])
{
$options['layout'] = \TwbsHelper\Form\View\Helper\Form::LAYOUT_HORIZONTAL;
parent::__construct('myForm', $options);
$this->add([
'name' => 'name',
'type' => Text::class,
'options' => [
'label' => 'Your name',
'label_attributes' => [
'column' => 'md-2',
'class' => 'col-form-label'
],
'column' => 'md-10'
],
'attributes' => [
'placeholder' => 'some value',
'class' => 'form-control'
],
]);
}
from twbs-helper-module.
This issue is stale
from twbs-helper-module.
Related Issues (20)
- This module stops to work today after latest laminas/laminas-servicemanager update to version 3.6.0 HOT 3
- Question: Remove dependencies to Laminas MVC?
- Support for Bootstrap 5 HOT 8
- Possibility to disable "properIndentation" HOT 4
- Version 36.3 released in Packagist HOT 1
- Fieldset label not displayed HOT 2
- Label of radios are rendered at the end of the list. HOT 2
- Label of radios rendered underneath the elements in Version 4.1.1 HOT 4
- Ignore dev file for dist package
- Additional class for column HOT 1
- Layout Horizontal not working? HOT 4
- Horizontal Layout class not applied and div missing HOT 4
- how do i put a class in the parent div of a radio button? HOT 4
- Assets loading on relative path
- Migrating to PHP 7.4 can't use twbs form in template HOT 3
- Sample (documentation) dropdowns seems to be broken HOT 4
- The FormElement view helper doesn't add is-invalid class HOT 2
- Possibility to provide valid and invalid feedback HOT 1
- After 3.2.0 I'm unable to group buttons from the form the form helper. HOT 5
- File upload seems to pass an array to escape helper HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from twbs-helper-module.