Skip to content
Permalink
Browse files

Added more docs for Form::label()

  • Loading branch information...
lorenzo committed Mar 7, 2014
1 parent 47c6a5c commit 3a384b8d9ad1fe6fbc3e5dc03cc3a8080d675164
Showing with 16 additions and 6 deletions.
  1. +16 −6 src/View/Helper/FormHelper.php
@@ -630,33 +630,43 @@ public function error($field, $text = null, $options = []) {
* The text and for attribute are generated off of the fieldname
*
* {{{
* echo $this->Form->label('Post.published');
* echo $this->Form->label('published');
* <label for="PostPublished">Published</label>
* }}}
*
* Custom text:
*
* {{{
* echo $this->Form->label('Post.published', 'Publish');
* <label for="PostPublished">Publish</label>
* echo $this->Form->label('published', 'Publish');
* <label for="published">Publish</label>
* }}}
*
* Custom class name:
*
* {{{
* echo $this->Form->label('Post.published', 'Publish', 'required');
* <label for="PostPublished" class="required">Publish</label>
* echo $this->Form->label('published', 'Publish', 'required');
* <label for="published" class="required">Publish</label>
* }}}
*
* Custom attributes:
*
* {{{
* echo $this->Form->label('Post.published', 'Publish', array(
* echo $this->Form->label('published', 'Publish', array(
* 'for' => 'post-publish'
* ));
* <label for="post-publish">Publish</label>
* }}}
*
* Nesting an input tag:
*
* {{{
* echo $this->Form->label('published', 'Publish', array(
* 'for' => 'published',
* 'input' => $this->text('published')
* ));
* <label for="post-publish">Publish <input type="text" name="published"></label>
* }}}
*
* @param string $fieldName This should be "Modelname.fieldname"
* @param string $text Text that will appear in the label field. If
* $text is left undefined the text will be inflected from the

0 comments on commit 3a384b8

Please sign in to comment.
You can’t perform that action at this time.