Issues

Issue #25 resolved

Label Requires Option

Alexander Kornilov
created an issue

I propose to add this into file "\components\BSHtml.php" on line 1761 (activeControlGroup method):

if ($labelOptions !== false && $layout !== self::FORM_LAYOUT_INLINE) {
    if (isset($labelOptions['ex']) && $labelOptions['ex'] === true) {
    // todo: consider adding support for overriding the label with plain text.
      $output .= parent::activeLabelEx($model, $attribute, $labelOptions);
    }
    else {
        $output .= parent::activeLabel($model, $attribute, $labelOptions);
    }
}

Comments (6)

  1. Pascal Brewing repo owner

    At the moment there are

    if ($labelOptions !== false && $layout !== self::FORM_LAYOUT_INLINE) {
                // todo: consider adding support for overriding the label with plain text.
                $output .= parent::activeLabelEx($model, $attribute, $labelOptions);
            }
    

    your way forced people to change all her projects plz set other way and send a pull request and a code example

  2. Alexander Kornilov reporter

    Well. Then:

    if ($labelOptions !== false && $layout !== self::FORM_LAYOUT_INLINE) {
        if (isset($labelOptions['ex']) && empty($labelOptions['ex'])) {
        // todo: consider adding support for overriding the label with plain text.
          $output .= parent::activeLabel($model, $attribute, $labelOptions);
        }
        else {
            $output .= parent::activeLabelEx($model, $attribute, $labelOptions);
        }
    }
    

    It doesn't make anything to rewrite in existing projects. Example label without requires mark "*":

    echo $form->textFieldControlGroup($model, 'login', array(
        'labelOptions' => array(
            'ex' => false, // or => ''
        )
    ));
    
  3. Log in to comment