We override the initialize function as this is the only place
where we can dispatch an event which can validate the input when
it has been bound with values.

{@inheritdoc}
175187
protected function initialize(InputInterface $input, OutputInterface $output)
    {
        $this->getApplication()->getDispatcher()->dispatch(
            GushEvents::INITIALIZE,
            new ConsoleCommandEvent($this, $input, $output)
        );
    }
30808
function init($idBuilder="0", $tabOnglets=array())
    {
        $this->ongletsArray=$tabOnglets;
        $this->typeOngletsArray=array();
        $this->optionsOngletParType = array();
        $this->idOngletBuilder=$idBuilder;
        $this->largeurTotale=680;
        $this->largeurEtiquette=150;
        $this->numOngletSelected=0;
        $this->champHiddenCourant="";
        $this->isContours = true;
        $this->isAncreOnglet = true;
        $this->isSpaceInLibelle = true;
        $this->styleContenu = "";
    }
1183710
private function init()
    {
        $aData = $this->data;

        $this
            // Required value rules
            ->addRule(
                'required',
                function ($sFieldName) use ($aData) {
                    if (\nadir\core\validator\Validator::isIndexSet(
                        $aData,
                        $sFieldName
                    )) {
                        return true;
                    }
                    return false;
                },
                function ($sFieldName) {
                    return "Field '{$sFieldName}' is required.";
                }
            )
            // String rules
            ->addRule(
                'string',
                function ($sFieldName, array $aOpt = array()) use ($aData) {
                    if (\nadir\core\validator\Validator::isIndexSet(
                        $aData,
                        $sFieldName
                    )) {
                        $mValue = \nadir\core\validator\Validator
                        ::getArrayItemByPointSeparatedKey($aData, $sFieldName);
                        if (!is_string($mValue)) {
                            return false;
                        }
                        if (isset($aOpt['notEmpty'])) {
                            $mTmp = trim($mValue);
                            if ($aOpt['notEmpty'] && empty($mTmp)) {
                                return false;
                            }
                            if (!$aOpt['notEmpty'] && !empty($mTmp)) {
                                return false;
                            }
                        }
                        if (isset($aOpt['pattern'])) {
                            if (!preg_match($aOpt['pattern'], $mValue)) {
                                return false;
                            }
                        }
                        if (isset($aOpt['length'])) {
                            $nLength = mb_strlen($mValue, 'UTF-8');
                            if (isset($aOpt['length']['min'])) {
                                if ($nLength < $aOpt['length']['min']) {
                                    return false;
                                }
                            }
                            if (isset($aOpt['length']['max'])) {
                                if ($nLength > $aOpt['length']['max']) {
                                    return false;
                                }
                            }
                            if (isset($aOpt['length']['equal'])) {
                                if ($nLength != $aOpt['length']['equal']) {
                                    return false;
                                }
                            }
                        }
                    }
                    return true;
                },
                function ($sFieldName, array $aOpt = array()) {
                    if (!empty($aOpt)) {
                        $aKeys = array_keys($aOpt);
                        $sKeys = implode(', ', $aKeys);
                        return "Invalid string field '{$sFieldName}' value. "
                        . "Validation options: {$sKeys}";
                    }
                    return "Invalid string field '{$sFieldName}' value.";
                }
            )
            // Number rules
            ->addRule(
                'number',
                function ($sFieldName, array $aOpt = array()) use ($aData) {
                    if (\nadir\core\validator\Validator::isIndexSet(
                        $aData,
                        $sFieldName
                    )) {
                        $mValue = \nadir\core\validator\Validator
                        ::getArrayItemByPointSeparatedKey($aData, $sFieldName);
                        if (!is_numeric($mValue)) {
                            return false;
                        }
                        if (isset($aOpt['float'])) {
                            if ($aOpt['float'] && !is_float($mValue)) {
                                return false;
                            }
                            if (!$aOpt['float'] && is_float($mValue)) {
                                return false;
                            }
                        }
                        if (isset($aOpt['integer'])) {
                            if ($aOpt['integer'] && !is_int($mValue)) {
                                return false;
                            }
                            if (!$aOpt['integer'] && is_int($mValue)) {
                                return false;
                            }
                        }
                        if (isset($aOpt['positive'])) {
                            if ($aOpt['positive'] && $mValue <= 0) {
                                return false;
                            }
                            if (!$aOpt['positive'] && $mValue >= 0) {
                                return false;
                            }
                        }
                        if (isset($aOpt['value'])) {
                            if (isset($aOpt['value']['equal'])) {
                                if ($mValue != $aOpt['value']['equal']) {
                                    return false;
                                }
                            }
                            if (isset($aOpt['value']['min'])) {
                                if ($mValue < $aOpt['value']['min']) {
                                    return false;
                                }
                            }
                            if (isset($aOpt['value']['max'])) {
                                if ($mValue > $aOpt['value']['max']) {
                                    return false;
                                }
                            }
                        }
                    }
                    return true;
                },
                function ($sFieldName, array $aOpt = array()) {
                    if (!empty($aOpt)) {
                        $aKeys = array_keys($aOpt);
                        $sKeys = implode(', ', $aKeys);
                        return "Invalid number field '{$sFieldName}' value. "
                        . "Validation options: {$sKeys}";
                    }
                    return "Invalid number field '{$sFieldName}' value.";
                }
            )
            // Array rules
            ->addRule(
                'array',
                function ($sFieldName, array $aOpt = array()) use ($aData) {
                    if (\nadir\core\validator\Validator::isIndexSet(
                        $aData,
                        $sFieldName
                    )) {
                        $mValue = \nadir\core\validator\Validator
                        ::getArrayItemByPointSeparatedKey($aData, $sFieldName);
                        if (!is_array($mValue)) {
                            return false;
                        }
                        if (isset($aOpt['assoc'])) {
                            $funcIsAssoc = function (array $aArray) {
                                // return false if array is empty
                                return (bool) count(array_filter(
                                    array_keys($aArray),
                                    'is_string'
                                ));
                            };
                            if ($aOpt['assoc'] && !$funcIsAssoc($mValue)) {
                                return false;
                            }
                            if (!$aOpt['assoc'] && $funcIsAssoc($mValue)) {
                                return false;
                            }
                            unset($funcIsAssoc);
                        }
                        if (isset($aOpt['length'])) {
                            $nLength = count($mValue);
                            if (isset($aOpt['length']['min'])) {
                                if ($nLength < $aOpt['length']['min']) {
                                    return false;
                                }
                            }
                            if (isset($aOpt['length']['max'])) {
                                if ($nLength > $aOpt['length']['max']) {
                                    return false;
                                }
                            }
                            if (isset($aOpt['length']['equal'])) {
                                if ($nLength != $aOpt['length']['equal']) {
                                    return false;
                                }
                            }
                        }
                    }
                    return true;
                },
                function ($sFieldName, array $aOpt = array()) {
                    if (!empty($aOpt)) {
                        $aKeys = array_keys($aOpt);
                        $sKeys = implode(', ', $aKeys);
                        return "Invalid array field '{$sFieldName}' value. "
                        . "Validation options: {$sKeys}";
                    }
                    return "Invalid array field '{$sFieldName}' value.";
                }
            )
            // Boolean rules
            ->addRule(
                'boolean',
                function ($sFieldName, array $aOpt = array()) use ($aData) {
                    if (\nadir\core\validator\Validator::isIndexSet(
                        $aData,
                        $sFieldName
                    )) {
                        $mValue = \nadir\core\validator\Validator
                        ::getArrayItemByPointSeparatedKey($aData, $sFieldName);
                        if (!is_bool($mValue)) {
                            return false;
                        }
                        if (isset($aOpt['isTrue'])) {
                            if ($aOpt['isTrue'] && !$mValue) {
                                return false;
                            }
                            if (!$aOpt['isTrue'] && $mValue) {
                                return false;
                            }
                        }
                    }
                    return true;
                },
                function ($sFieldName, array $aOpt = array()) {
                    if (!empty($aOpt)) {
                        $aKeys = array_keys($aOpt);
                        $sKeys = implode(', ', $aKeys);
                        return "Invalid boolean field '{$sFieldName}' value. "
                        . "Validation options: {$sKeys}";
                    }
                    return "Invalid boolean field '{$sFieldName}' value.";
                }
            );
    }
995558
public function init()
    {
        if ($this->form->enableClientScript === true && $this->form->enableClientValidation === true) {
            Html::addCssClass($this->inputOptions, ['inputValidation' => 'validate']);
        }

        if ($this->model->hasErrors()) {
            Html::addCssClass($this->inputOptions, $this->form->errorCssClass);
        }

        if ($this->showCharacterCounter === true) {
            $this->inputOptions['showCharacterCounter'] = true;
        }
    }
591350
protected function onInit()
    {
        if (is_array($this->params)) {
            $this->override = Utility::get($this->params, "{override}", false);
        }

    }
256392
protected void init() {
        FormModel model = createFormModel();
        if(getId() == null)
            formId = model.getId();
        if (model instanceof ValidatingFormModel) {
            ValidatingFormModel validatingFormModel = (ValidatingFormModel) model;
            setFormModel(validatingFormModel);
        } else {
            throw new IllegalArgumentException("Unsupported form model implementation " + formModel);
        }
        getApplicationConfig().applicationObjectConfigurer().configure(this, getId());
	}
680127
public function initialize()
    {
        if (is_null($value = $this->getValue())) {
            $value = request()->input($this->getAlias());
        }

        $this->setValue($value);
    }
1040241
function postInitialize( $currentVersion = null, $originalContentObjectAttribute = null )
    {
        if ( $originalContentObjectAttribute === null )
            $originalContentObjectAttribute = $this;
        $classAttribute = $this->contentClassAttribute();
        $dataType = $classAttribute->dataType();
        if ( $dataType )
            $dataType->postInitializeObjectAttribute( $this, $currentVersion, $originalContentObjectAttribute );
    }
680079
public function initialise(Input $input, Dispatcher $dispatcher = null)
	{
		$this->input      = $input;
		$this->dispatcher = $dispatcher;
	}
567885
protected void init() {
		addPropertyChangeListener(ENABLED_PROPERTY, new PropertyChangeListener() {

			public void propertyChange(PropertyChangeEvent evt) {
				validatingUpdated();
			}

		});
		validationResultsModel.addPropertyChangeListener(ValidationResultsModel.HAS_ERRORS_PROPERTY,
				childStateChangeHandler);
	}
548600
public function init()
    {
        $this->_processRequest();

        // storing current view
        $shouldInitialize = $this->shouldInitializeComponents();

        // init all components if there are any
        if ($this->_blLoadComponents) {
            foreach ($this->_getComponentNames() as $componentName => $isNotCacheable) {
                // do not override initiated components
                if (!isset($this->_oaComponents[$componentName])) {
                    // component objects MUST be created to support user called functions
                    $component = oxNew($componentName);
                    $component->setParent($this);
                    $component->setThisAction($componentName);
                    $this->_oaComponents[$componentName] = $component;
                }

                // do we really need to initiate them ?
                if ($shouldInitialize) {
                    $this->_oaComponents[$componentName]->init();

                    // executing only is view does not have action method
                    if (!method_exists($this, $this->getFncName())) {
                        $this->_oaComponents[$componentName]->executeFunction($this->getFncName());
                    }
                }
            }
        }

        parent::init();
    }
43127
final function onFormInitialized() {
		parent::onFormInitialized();
		$this->addClass('df-google-font');
		df_fe_init($this, __CLASS__, df_asset_third_party('Select2/main.css'), [
			'dataSource' => df_url_frontend('df-google-font')
			,'value' => $this['value'] // 2015-12-07 It is the selected value.
		]);
	}
1179683
private function _initialize()
    {
        $params = $this->getParameters();
        $n = count($params);

        if ($params !== null) {
            for ($i = 0; $i < $n; $i++) {
                if ($params[$i] !== null) {
                    $name = $params[$i]->getName();
                    switch ($name) {
                        case 'begintoken':
                            $this->_beginToken = $params[$i]->getValue();
                            break;
                        case 'endtoken':
                            $this->_endToken = $params[$i]->getValue();
                            break;
                        case 'dir':
                            $this->_dir = $params[$i]->getValue();
                            break;
                        case 'prefix':
                            $this->_prefix = $params[$i]->getValue();
                            break;
                        case 'postfix':
                            $this->_postfix = $params[$i]->getValue();
                            break;
                        case 'translatehtml':
                            $this->_translatehtml = $params[$i]->getValue();
                            break;
                    }
                }
            }
        }
    }
1324863
public function initializeArguments()
    {
        parent::initializeArguments();
        $this->registerUniversalTagAttributes();
        $this->registerTagAttribute('multiple', 'string', 'if set, multiple select field');
        $this->registerTagAttribute('size', 'string', 'Size of input field');
        $this->registerTagAttribute('disabled', 'boolean', 'Specifies that the input element should be disabled when the page loads', false, false);
        $this->registerTagAttribute('required', 'boolean', 'Specifies that the select element requires at least one selected option', false, false);
        $this->registerArgument('options', 'array', 'Associative array with internal IDs as key, and the values are displayed in the select box', true);
        $this->registerArgument('optionValueField', 'string', 'If specified, will call the appropriate getter on each object to determine the value.');
        $this->registerArgument('optionLabelField', 'string', 'If specified, will call the appropriate getter on each object to determine the label.');
        $this->registerArgument('sortByOptionLabel', 'boolean', 'If true, List will be sorted by label.', false, false);
        $this->registerArgument('selectAllByDefault', 'boolean', 'If specified options are selected if none was set before.', false, false);
        $this->registerArgument('errorClass', 'string', 'CSS class to set if there are errors for this ViewHelper', false, 'f3-form-error');
        $this->registerArgument('translate', 'array', 'Configures translation of ViewHelper output.');
        $this->registerArgument('prependOptionLabel', 'string', 'If specified, will provide an option at first position with the specified label.');
        $this->registerArgument('prependOptionValue', 'string', 'If specified, will provide an option at first position with the specified value. This argument is only respected if prependOptionLabel is set.');
    }
1228080
public function init()
	{
		if(!isset($this->htmlOptions['id']))
			$this->htmlOptions['id']=$this->id;
		else
			$this->id=$this->htmlOptions['id'];

		if($this->stateful)
			echo CHtml::statefulForm($this->action, $this->method, $this->htmlOptions);
		else
			echo CHtml::beginForm($this->action, $this->method, $this->htmlOptions);

		if($this->errorMessageCssClass===null)
			$this->errorMessageCssClass=CHtml::$errorMessageCss;
	}
586083
public function init()
    {
        parent::init();

        if ($this->required && $this->parent instanceof SwatFormField) {
            $this->parent->required = true;
        }
    }
909430
public function Initialize() {
      parent::Initialize();
      Gdn_Theme::Section('Dashboard');
      $this->AddJsFile('log.js');
      $this->AddJsFile('jquery.expander.js');
      $this->AddJsFile('jquery-ui.js');
      $this->Form->InputPrefix = '';
   }