Horde::label PHP Méthode

label() public static méthode

Returns a label element including an access key for usage in conjuction with a form field. User preferences regarding access keys are respected.
public static label ( string $for, string $label, string $ak = null ) : string
$for string The form field's id attribute.
$label string The label text.
$ak string The access key to use. If null a new access key will be generated.
Résultat string The html code for the label element.
    public static function label($for, $label, $ak = null)
    {
        if (is_null($ak)) {
            $ak = self::getAccessKey($label, 1);
        }
        $label = self::highlightAccessKey($label, $ak);
        return sprintf('<label for="%s"%s>%s</label>', $for, !empty($ak) ? ' accesskey="' . $ak . '"' : '', $label);
    }

Usage Example

Exemple #1
0
 /**
  */
 protected function _content()
 {
     global $page_output;
     $name = strval(new Horde_Support_Randomid());
     $page_output->addScriptFile('vatid.js', 'horde');
     $page_output->addInlineScript(array('$("' . $name . '").observe("submit", HordeBlockVatid.onSubmit.bindAsEventListener(HordeBlockVatid))'), true);
     return '<form style="padding:2px" action="' . $this->_ajaxUpdateUrl() . '" id="' . $name . '">' . Horde_Util::formInput() . Horde::label('vatid', _("VAT identification number:")) . '<br /><input type="text" length="14" name="vatid" />' . '<br /><input type="submit" id="vatbutton" value="' . _("Check") . '" class="horde-default" /> ' . Horde_Themes_Image::tag('loading.gif', array('alt' => _("Checking"), 'attr' => array('style' => 'display:none'))) . '<div class="vatidResults"></div>' . '</form>';
 }
All Usage Examples Of Horde::label