UPDATE-RATE

Die Test-Installation wird aktuell zwischen 8:00 und 18:00 Uhr stündlich zur vollen Stunde aktualisiert.

Alles neu macht der Mai

ILIAS 9 ist da! Alle Infos zu den Highlights der neuen Version gibt es hier!

Documentation

Kitchen Sink documentation of style: 'Delos' of skin: 'ILIAS'

Color Picker

Description

Purpose
A Color Picker Input is used to select a color value.
Composition
Color Picker will render an input-tag with type="color".
Effect
As soon as the Color Picker is clicked, a pop-up window opens, which contains the individual options of the color selection.
Context
  1. The Color Picker input is used in UI-forms.

Rules

Usage
  1. The Color Picker should be used to select an individual color value.

Example 1: Base


click to select a color
<?php
 
declare(strict_types=1);
 
/**
 * This file is part of ILIAS, a powerful learning management system
 * published by ILIAS open source e-Learning e.V.
 *
 * ILIAS is licensed with the GPL-3.0,
 * see https://www.gnu.org/licenses/gpl-3.0.en.html
 * You should have received a copy of said license along with the
 * source code, too.
 *
 * If this is not the case or you just want to try ILIAS, you'll find
 * us at:
 * https://www.ilias.de
 * https://github.com/ILIAS-eLearning
 *
 *********************************************************************/
 
namespace ILIAS\UI\examples\Input\Field\ColorPicker;
 
/**
 * Base example showing how to plug a colorpicker into a form
 */
function base()
{
    //Step 0: Declare dependencies
    global $DIC;
    $ui = $DIC->ui()->factory();
    $renderer = $DIC->ui()->renderer();
    $request = $DIC->http()->request();
 
    //Step 1: Define the input field
    $color_input = $ui->input()->field()->colorpicker("Color", "click to select a color");
 
    //Step 2: Define the form and attach the field.
    $form = $ui->input()->container()->form()->standard('#', ['color' => $color_input]);
 
    //Step 3: Define some data processing.
    $result = '';
    if ($request->getMethod() == "POST") {
        $form = $form->withRequest($request);
        $result = $form->getData();
    }
 
    //Step 4: Render the form/result.
    return
        "<pre>" . print_r($result, true) . "</pre><br/>" .
        $renderer->render($form);
}
 

Relations

Parents
  1. UIComponent
  2. Input
  3. Field