[NFR] Phalcon\Forms\Form::label() extra param
\Phalcon\Forms\Form::label(string $name) according to the doc, "Generate the label of a element added to the form including HTML"
I think it's need to have extra $attributes param, because it's mean to render HTML, so it will be consistent with render method.
ex:
$form->label('name', array('class' => 'form-control'));
but right now, what i have to do...
<label for="name" class="form-control"><?=$form->getLabel('name'); ?></label>
CMIIW
Test it, Indeed return label tag:
<?php
use Phalcon\Forms\Form,
Phalcon\Forms\Element\Text,
Phalcon\Forms\Element\Select;
$form = new Form();
$form->add(new Text("telephone", array(
'maxlength' => 30,
'placeholder' => 'Type your name'
)));
$text = $form->get('telephone');
echo $form->label('telephone');
echo PHP_EOL;
echo $form->getLabel('telephone');
echo PHP_EOL;
echo $text->getName();
output:
<label for="telephone">telephone</label>
telephone
telephone
This is implemented in 1.3.0
Using this, how does one generate a label as
<label for="telephone">Enter your number:</label>
instead of
<label for="telephone">telephone</label>
@PersyJack
echo $text->setLabel('Enter your number:');
@dreamsxin Thank you, I was studying Vokuro and I tried adding 'text' => 'Enter phone number' to login controller where it has
$email = new Text('email', array(
'placeholder' => 'Email'
));
but that just added a text attribute to the input. After your reply, I found that it was setup up that way in signup controller. Thank you again