Class humhub\compat\CHtml

Inheritancehumhub\compat\CHtml » yii\helpers\Html

CHtml - Yii1 compatiblity

Public Methods

Hide inherited methods

MethodDescriptionDefined By
activeCheckboxNoLabel() Active Checkbox without Label humhub\compat\CHtml
activeLabelEx() Generates a label tag for a model attribute. humhub\compat\CHtml
activeTextField() Generates a text field input for a model attribute. humhub\compat\CHtml
ajaxButton() humhub\compat\CHtml
form() humhub\compat\CHtml
getIdByName() Generates a valid HTML ID based on name. humhub\compat\CHtml
hiddenField() humhub\compat\CHtml
modelName() Generates HTML name for given model. humhub\compat\CHtml
resolveName() Generates input name for a model attribute. humhub\compat\CHtml
resolveNameID() Generates input name and ID for a model attribute. humhub\compat\CHtml

Method Details

activeCheckboxNoLabel() public static method

Active Checkbox without Label

public static \humhub\compat\type activeCheckboxNoLabel ( $model, $attribute, $options = [] )
$model \humhub\compat\type
$attribute \humhub\compat\type
$options \humhub\compat\type
activeLabelEx() public static method

Generates a label tag for a model attribute.

This is an enhanced version of {@link activeLabel}. It will render additional CSS class and mark when the attribute is required. In particular, it calls {@link CModel::isAttributeRequired} to determine if the attribute is required. If so, it will add a CSS class {@link CHtml::requiredCss} to the label, and decorate the label with {@link CHtml::beforeRequiredLabel} and {@link CHtml::afterRequiredLabel}.

public static string activeLabelEx ( $model, $attribute, $htmlOptions = [] )
$model \humhub\compat\CModel

The data model

$attribute string

The attribute

$htmlOptions array

Additional HTML attributes.

return string

The generated label tag

activeTextField() public static method

Generates a text field input for a model attribute.

If the attribute has input error, the input field's CSS class will be appended with {@link errorCss}.

See also:

  • \humhub\compat\clientChange
  • \humhub\compat\activeInputField
public static string activeTextField ( $model, $attribute, $htmlOptions = [] )
$model \humhub\compat\CModel

The data model

$attribute string

The attribute

$htmlOptions array

Additional HTML attributes. Besides normal HTML attributes, a few special attributes are also recognized (see {@link clientChange} and {@link tag} for more details.)

return string

The generated input field

ajaxButton() public method

public void ajaxButton ( )
form() public static method

public static void form ( $action, $method "POST" )
$action
$method
getIdByName() public static method

Generates a valid HTML ID based on name.

public static string getIdByName ( $name )
$name string

Name from which to generate HTML ID

return string

The ID generated based on name.

hiddenField() public static method

public static void hiddenField ( $name, $value )
$name
$value
modelName() public static method (available since version 1.1.14)

Generates HTML name for given model.

See also humhub\compat\CHtml::setModelNameConverter().

public static string modelName ( $model )
$model \humhub\compat\CModel|string

The data model or the model class name

return string

The generated HTML name value

resolveName() public static method

Generates input name for a model attribute.

Note, the attribute name may be modified after calling this method if the name contains square brackets (mainly used in tabular input) before the real attribute name.

public static string resolveName ( $model, &$attribute )
$model \humhub\compat\CModel

The data model

$attribute string

The attribute

return string

The input name

resolveNameID() public static method

Generates input name and ID for a model attribute.

This method will update the HTML options by setting appropriate 'name' and 'id' attributes. This method may also modify the attribute name if the name contains square brackets (mainly used in tabular input).

public static void resolveNameID ( $model, &$attribute, &$htmlOptions )
$model \humhub\compat\CModel

The data model

$attribute string

The attribute

$htmlOptions array

The HTML options