Maslosoft Framework Logo Maslosoft Framework Documentation
Flexible Application Foundation


Toggle Renderer

There are two distinct classes for form and grid renderers, however base name is same for them.

The fully qualified class names:

Toggle for grid/list

Toggle renderer might be used to render values in grid:

Use Toggle renderer to render simple Yes or No in grid column, whether value evaluates - respectively - to true or false.

While the value is not strictly compared, it is recommended to be of type boolean.

Example usage:

@GridRenderer(Toggle)

Toggle for forms

The Toggle can be used to render checkbox value in forms:

Use Toggle form renderer to render checkbox in form. The value of field, on which this renderer is used must be boolean, as checkbox state is strictly compared.

Example usage:

@GridRenderer(Toggle)

If You need to use both, use them with alias.

To make sure that Your IDE will keep imports, the @see PHPDOC notation can be used.

Example of using with alias:

...
use Maslosoft\Widgets\Grid\Column\Toggle as GridToggle;
use Maslosoft\Widgets\Renderers\Form\Toggle as FormToggle;

class Site extends MongoDocument
{
    ...
    /**
     * @GridRenderer(GridToggle)
     * @FormRenderer(FormToggle)
     * @see GridToggle
     * @see FormToggle
     */
    public $enabled = false;
    ...
}