This renderer displays apropriately scaled squares with common movie/photo proportions list. These squares are active - when clicked will set proper value of bindable field.
div with proportions applied:
To get such result as above example, add
@FormRenderer annotation with class of
Proportions for field containing proportions value. This value is a string with ratio noted as
together - separated with colon.
Example usage on model:
/** * @Label('Proportions') * @FormRenderer(Proportions) * @see Proportions * @var string */ public $proportions;
Then render with form:
$form = ActiveForm::widget([ 'model' => new ExampleProportionsRenderer() ]); echo $form->renderField('proportions');