Initializes every field extension if extension.

@throws \FSi\Component\DataSource\Exception\DataSourceException
181040
private function initFieldTypesExtensions()
    {
        $fieldTypesExtensions = $this->loadFieldTypesExtensions();
        foreach ($fieldTypesExtensions as $extension) {
            if (!$extension instanceof FieldExtensionInterface) {
                throw new DataSourceException(sprintf("Expected instance of FSi\Component\DataSource\Field\FieldExtensionInterface but %s got", get_class($extension)));
            }

            $types = $extension->getExtendedFieldTypes();
            foreach ($types as $type) {
                if (!isset($this->fieldTypesExtensions)) {
                    $this->fieldTypesExtensions[$type] = [];
                }
                $this->fieldTypesExtensions[$type][] = $extension;
            }
        }
    }
1105006
private function initTypeExtensions(): void
    {
        $this->typeExtensions = [];

        foreach ($this->loadTypeExtensions() as $extension) {
            if (!$extension instanceof ObjectTypeExtensionInterface) {
                throw new UnexpectedTypeException($extension, 'Fxp\Component\DefaultValue\ObjectTypeExtensionInterface');
            }

            $type = $extension->getExtendedType();

            $this->typeExtensions[$type][] = $extension;
        }
    }
740850
protected function init()
    {
        if (true===$this->isInited) {
            return;
        }

        $this->_cleanFilesStack();

        if (empty($this->__adapter_type)) {
            $this->_guessAdapterType();
        }

        if (!empty($this->__adapter_type)) {
            if (class_exists($this->__adapter_type)) {
                $this->__adapter = new $this->__adapter_type;
                if (!($this->__adapter instanceof AbstractCompressorAdapter)) {
                    throw new \LogicException(
                        sprintf('Compressor adapter must extend class "%s" (having object "%s")!', "Assets\AbstractCompressorAdapter", $this->__adapter_type)
                    );
                }
            } else {
                throw new \RuntimeException(
                    sprintf('Compressor adapter for type "%s" doesn\'t exist!', $this->__adapter_type)
                );
            }
        }

        $this->isInited = true;
    }
748277
def _init_fields(self):
        """"""
        if self.opts.fields:
            available_field_names = self.set_class(self.opts.fields)
        else:
            available_field_names = self.set_class(self.declared_fields.keys())
            if self.opts.additional:
                available_field_names |= self.set_class(self.opts.additional)

        invalid_fields = self.set_class()

        if self.only is not None:
            # Return only fields specified in only option
            field_names = self.set_class(self.only)

            invalid_fields |= field_names - available_field_names
        else:
            field_names = available_field_names

        # If "exclude" option or param is specified, remove those fields.
        exclude_field_names = set(self.opts.exclude) | set(self.exclude)
        if exclude_field_names:
            # Note that this isn't available_field_names, since we want to
            # apply "only" for the actual calculation.
            field_names = field_names - exclude_field_names

            invalid_fields |= exclude_field_names - available_field_names

        if invalid_fields:
            message = 'Invalid fields for {}: {}.'.format(self, invalid_fields)
            raise ValueError(message)

        fields_dict = self.dict_class()
        for field_name in field_names:
            field_obj = self.declared_fields.get(field_name, ma_fields.Inferred())
            self._bind_field(field_name, field_obj)
            fields_dict[field_name] = field_obj

        dump_data_keys = [
            obj.data_key or name for name, obj in iteritems(fields_dict) if not obj.load_only
        ]
        if len(dump_data_keys) != len(set(dump_data_keys)):
            data_keys_duplicates = {x for x in dump_data_keys if dump_data_keys.count(x) > 1}
            raise ValueError(
                'The data_key argument for one or more fields collides '
                "with another field's name or data_key argument. "
                'Check the following field names and '
                'data_key arguments: {}'.format(list(data_keys_duplicates)),
            )

        load_attributes = [
            obj.attribute or name for name, obj in iteritems(fields_dict) if not obj.dump_only
        ]
        if len(load_attributes) != len(set(load_attributes)):
            attributes_duplicates = {x for x in load_attributes if load_attributes.count(x) > 1}
            raise ValueError(
                'The attribute argument for one or more fields collides '
                "with another field's name or attribute argument. "
                'Check the following field names and '
                'attribute arguments: {}'.format(list(attributes_duplicates)),
            )

        return fields_dict
804024
protected function initialize()
    {
        if ('textarea' !== $this->node->nodeName) {
            throw new \LogicException(sprintf('A TextareaFormField can only be created from a textarea tag (%s given).', $this->node->nodeName));
        }

        $this->value = '';
        foreach ($this->node->childNodes as $node) {
            $this->value .= $node->wholeText;
        }
    }
498927
private function _publishExtensionClientInit()
    {
        $extensionOptionsJson = json_encode(array(
            'hashMethod'                => is_string($this->hashMethod) ? $this->hashMethod : 'php callback function',
            'resourceTypes'             => $this->resourceTypes,
            'enableLog'                 => $this->enableLog,
            'activateOnAllPages'        => $this->activateOnAllPages,
            'alwaysReloadableResources' => $this->alwaysReloadableResources,
            'jsGlobalObjPublicPath'     => $this->jsGlobalObjPublicPath(),
            'clientVarName'             => $this->clientVarName,
        ));
        $this->_publishExtensionJs('%extensionObject%.initExtension(%optionsJson%); ', array(
            '%extensionObject%' => self::JS_GLOBAL_OBJ_PRIVATE_PATH,
            '%optionsJson%'     => $extensionOptionsJson,
        ));
    }
383600
protected function initialize()
    {
        if ($this->isInitialized) {
            return;
        }
        if (!$this->dbAdapter instanceof Adapter) {
            throw new \Exception('No db adapter present');
        }
        if (!$this->hydrator instanceof HydratorInterface) {
            $this->hydrator = new ClassMethods;
        }
        if (!is_object($this->entityPrototype)) {
            throw new \Exception('No entity prototype set');
        }

        $this->isInitialized = true;
    }
1180546
public function init()
	{
		parent::init();

		if (!in_array($this->column->type, $this->supportedTypes)) {
			throw new CException(Yii::t(
				'zii',
				'Unsupported column type. Supported column types are: "{types}"',
				array(
					'{types}' => implode(', ', $this->supportedTypes)
				)
			));
		}
	}
159378
private function initTypeExtensions()
    {
        $this->typeExtensions = [];

        foreach ($this->loadTypeExtensions() as $extension) {
            if (!$extension instanceof BlockTypeExtensionInterface) {
                throw new Exception\UnexpectedTypeException(
                    $extension,
                    'Oro\Component\Layout\BlockTypeExtensionInterface'
                );
            }

            $type = $extension->getExtendedType();

            $this->typeExtensions[$type][] = $extension;
        }
    }
679025
public function init()
    {
        $default = $this->config->get('system.languages.default_lang');
        if (isset($default) && $this->validate($default)) {
            $this->default = $default;
        } else {
            $this->default = reset($this->languages);
        }

        $this->page_extensions = null;

        if (empty($this->languages)) {
            $this->enabled = false;
        }
    }
461119
protected function initializeFieldName()
    {
        $this->fieldName = $this->arguments['field'];

        if (empty($this->fieldName)
            && $this->fieldService->fieldContextExists()
        ) {
            $this->fieldName = $this->fieldService
                ->getCurrentField()
                ->getName();
        }

        if (null === $this->fieldName) {
            throw EntryNotFoundException::classViewHelperFieldNotFound($this->arguments['name']);
        }
    }
96565
private function initColumnTypeExtensions()
    {
        $this->columnTypeExtensions = [];

        foreach ($this->loadColumnTypeExtensions() as $extension) {
            if (!$extension instanceof ColumnTypeExtensionInterface) {
                throw new UnexpectedTypeException($extension, ColumnTypeExtensionInterface::class);
            }

            $type = $extension->getExtendedType();

            $this->columnTypeExtensions[$type][] = $extension;
        }
    }
114888
protected function initialize()
    {
        if ('input' !== $this->node->nodeName && 'button' !== $this->node->nodeName) {
            throw new \LogicException(sprintf('An InputFormField can only be created from an input or button tag (%s given).', $this->node->nodeName));
        }

        if ('checkbox' === strtolower($this->node->getAttribute('type'))) {
            throw new \LogicException('Checkboxes should be instances of ChoiceFormField.');
        }

        if ('file' === strtolower($this->node->getAttribute('type'))) {
            throw new \LogicException('File inputs should be instances of FileFormField.');
        }

        $this->value = $this->node->getAttribute('value');
    }
1076820
private function initFieldsTypes()
    {
        $this->fieldTypes = [];

        $fieldTypes = $this->loadFieldTypes();

        foreach ($fieldTypes as $fieldType) {
            if (!$fieldType instanceof FieldTypeInterface) {
                throw new DataSourceException(sprintf('Expected instance of FieldTypeInterface, "%s" given.', get_class($fieldType)));
            }

            if (isset($this->fieldTypes[$fieldType->getType()])) {
                throw new DataSourceException(sprintf('Error during field types loading. Name "%s" already in use.', $fieldType->getType()));
            }

            $this->fieldTypes[$fieldType->getType()] = $fieldType;
        }
    }
762895
public function init()
    {
        if (!$this->model) {
            throw new CException('Parameter "model" should be provided for EditableField');
        }

        if (!$this->attribute) {
            throw new CException('Parameter "attribute" should be provided for EditableField');
        }

        $originalModel = $this->model;
        $originalAttribute = $this->attribute;
        $originalText = strlen($this->text) ? $this->text : CHtml::value($this->model, $this->attribute);

        //if apply set manually to false --> just render text, no js plugin applied
        if($this->apply === false) {
            $this->text = $originalText;
        } else {
            $this->apply = true;
        }

        //try to resolve related model (if attribute contains '.')
        $resolved = $this->resolveModels($this->model, $this->attribute);
        $this->model = $resolved['model'];
        $this->attribute = $resolved['attribute'];
        $this->staticModel = $resolved['staticModel'];
        $staticModel = $this->staticModel;
        $isMongo = $resolved['isMongo'];
        $isFormModel = $this->model instanceOf CFormModel;
        
        //if real (related) model not exists --> just print text
        if(!$this->model) {
        	$this->apply = false;
        	$this->text = $originalText;
		}
        
        
        //for security reason only safe attributes can be editable (e.g. defined in rules of model)
        //just print text (see 'run' method)
        if (!$staticModel->isAttributeSafe($this->attribute)) {
            $this->apply = false;
            $this->text = $originalText;
        }
        
        /*
         try to detect type from metadata if not set
        */
        if ($this->type === null) {
            $this->type = 'text';
            if (!$isMongo && !$isFormModel && array_key_exists($this->attribute, $staticModel->tableSchema->columns)) {
                $dbType = $staticModel->tableSchema->columns[$this->attribute]->dbType;
                if($dbType == 'date') {
                    $this->type = 'date';
                }
                if($dbType == 'datetime') {
                    $this->type = 'datetime';
                }
                if(stripos($dbType, 'text') !== false) {
                    $this->type = 'textarea';
                }
            }
        }

        //name
        if(empty($this->name)) {
            $this->name = $isMongo ? $originalAttribute : $this->attribute;
        }
        
        //pk (for mongo takes pk from parent!)
        $pkModel = $isMongo ? $originalModel : $this->model; 
        if(!$isFormModel) {
            if($pkModel && !$pkModel->isNewRecord) {
                $this->pk = $pkModel->primaryKey;
            }
        } else {
            //formModel does not have pk, so set `send` option to `always` (send without pk)
            if(empty($this->send) && empty($this->options['send'])) {
                $this->send = 'always';
            }
        }      
        
        parent::init();        
        
        /*
         If text not defined, generate it from model attribute for types except lists ('select', 'checklist' etc)
         For lists keep it empty to apply autotext.
         $this->_prepareToAutotext calculated in parent class Editable.php
        */
        if (!strlen($this->text) && !$this->_prepareToAutotext) {
            $this->text = $originalText;
        }
        
        //set value directly for autotext generation
        if($this->model && $this->_prepareToAutotext) {
            $this->value = CHtml::value($this->model, $this->attribute); 
        }
        
        //generate title from attribute label
        if ($this->title === null) {
            $titles = array(
              'Select' => array('select', 'date'),
              'Check' => array('checklist')
            );
            $title = Yii::t('EditableField.editable', 'Enter');
            foreach($titles as $t => $types) {
                if(in_array($this->type, $types)) {
                   $title = Yii::t('EditableField.editable', $t);
                }
            }
            $this->title = $title . ' ' . $staticModel->getAttributeLabel($this->attribute);
        } else {
            $this->title = strtr($this->title, array('{label}' => $staticModel->getAttributeLabel($this->attribute)));
        }
        
        //scenario
        if($pkModel && !isset($this->params['scenario'])) {
            $this->params['scenario'] = $pkModel->getScenario(); 
        }        
    }
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.";
                }
            );
    }
268116
public function init()
    {
        if (preg_match(
                '/extendedsummary/i',
                $this->template
            ) && !empty($this->extendedSummary) && isset($this->extendedSummary['columns'])
        ) {
            $this->template .= "\n{extendedSummaryContent}";
            $this->displayExtendedSummary = true;
        }

        $this->attachBehavior('ywplugin', array('class' => 'yiiwheels.behaviors.WhPlugin'));
        $this->attachBehavior('ywchart', array('class' => 'yiiwheels.widgets.grid.behaviors.WhChart'));

        parent::init();
    }