Is displayable.

@param FormEvent $event
@param int       $i
@param string    $eventName

@return bool
488156
protected function isDisplayable(FormEvent $event, $i, $eventName)
    {
        $form = $event->getForm();
        $data = $event->getData();

        if (!isset($data[$i])) {
            return false;
        }

        $item = is_object($data[$i]) ? (array) $data[$i] : $data[$i];

        if (!is_array($item)) {
            return true;
        }

        if (FormEvents::PRE_SUBMIT === $eventName) {
            if (isset($item['__to_remove'])) {
                return !(bool) $item['__to_remove'];
            }
        }

        foreach ($item as $k => $v) {
            if (FormEvents::PRE_SUBMIT === $eventName &&
                HiddenType::class === get_class($form->get($i)->get($k)->getConfig()->getType()->getInnerType())
            ) {
                continue;
            }

            // Value not null
            if (null !== $v && '' !== $v) {
                return true;
            }
        }

        return false;
    }
1014478
function isInputEventSupported(eventName) {
            var el = document.createElement('input'),
            eventName = 'on' + eventName,
            isSupported = (eventName in el);
            if (!isSupported) {
                el.setAttribute(eventName, 'return;');
                isSupported = typeof el[eventName] == 'function';
            }
            el = null;
            return isSupported;
        }
1055190
public static function event(String $eventName, Array $parameters) : Bool
    {
        $events = Listener::select($eventName);

        $return = NULL;

        foreach( $events as $event )
        {
            $return = $event(...$parameters);
        }

        if( $return === false )
        {
            return false;
        }

        return true;
    }
356719
private function hasScript($eventName, $script)
    {
        $scripts = $this->event->getComposer()->getPackage()->getScripts();
        if (!isset($scripts[$eventName])) {
            return false;
        }

        return in_array($script, $scripts[$eventName]);
    }
424864
public function hydrateUpdateForm(FormEvent $event)
    {
        $data = $event->getData();

        $title = CustomerTitleQuery::create()->findPk($data["title_id"]);

        if (null === $title) {
            $this->entityNotFound($data["title_id"]);
        }

        $data["default"] |= (bool) $title->getByDefault();

        $titleI18ns = CustomerTitleI18nQuery::create()
            ->filterById($data["title_id"])
            ->find()
            ->toKeyIndex('Locale')
        ;

        $i18n = &$data["i18n"];

        foreach ($data["i18n"] as $key => $value) {
            $i18n[$value["locale"]] = $value;

            unset($i18n[$key]);
        }


        /** @var \Thelia\Model\CustomerTitleI18n $titleI18n */
        foreach ($titleI18ns as $titleI18n) {
            $row = array();

            $row["locale"] = $locale = $titleI18n->getLocale();
            $row["short"] = $titleI18n->getShort();
            $row["long"] = $titleI18n->getLong();

            if (!isset($i18n[$locale])) {
                $i18n[$locale] = array();
            }

            $i18n[$locale] = array_merge($row, $i18n[$locale]);
        }

        $event->setData($data);
    }
1080505
public static function getInputByIdSelector($formName, $fieldId)
    {
        $formSelector = static::getFormByNameSelector($formName);
        $fieldId = trim($fieldId);

        if (empty($formSelector) || empty($fieldId)) {
            return '';
        }

        return sprintf('%s input#%s', $formSelector, $fieldId);
    }
393305
public function initialize($eventName)
    {
        $this->assertNotEmpty();

        $step = $this->getStepForEvent($eventName);

        $this->currentStep = $step->getName();

        $this->initialized = true;
    }
332915
public function hasListeners(string $eventName) : bool
    {
        return isset($this->events[$eventName]) && count($this->events[$eventName]) > 0;
    }
537983
public function onPreSetData(FormEvent $event)
    {
        $contentLanguages = [];
        $form = $event->getForm();

        /** @var TranslationAddData $data */
        $data = $event->getData();
        $contentType = $data->getContentType();

        if (null !== $contentType) {
            $contentLanguages = array_keys($contentType->getNames());
        }

        $this->addLanguageFields($form, $contentLanguages);
    }
879924
function onQuickFormEvent($event, $arg, &$caller)
    {
        switch ($event) {
            case 'createElement':
                $choices=array();
                $choices[0] = get_string('no');
                $choices[1] = get_string('yes');
                $this->load($choices);
                break;
        }
        return parent::onQuickFormEvent($event, $arg, $caller);
    }
921822
function onQuickFormEvent($event, $arg, &$caller)
    {
        switch ($event) {
            case 'createElement':
                $this->_formid = $caller->getAttribute('id');
                break;
        }
        return parent::onQuickFormEvent($event, $arg, $caller);
    }
193012
public function preSetData(FormEvent $event)
    {
        $form = $event->getForm();

        foreach ($form as $name => $child) {
            $form->remove($name);
        }
    }
1290733
public function hasListeners($eventName)
    {
        if ($listeners = $this->events->getListeners($eventName)) {
            return true;
        }

        if ($listeners = $this->events->getListeners($eventName, 'before')) {
            return true;
        }

        if ($listeners = $this->events->getListeners($eventName, 'after')) {
            return true;
        }

        return false;
    }
482989
public function postSubmitDocumentParent(FormEvent $event)
    {
        $document = $event->getData();

        if ($document->getParent()) {
            return;
        }

        $form = $event->getForm();
        $webspaceKey = $form->getConfig()->getAttribute('webspace_key');
        $parent = $this->documentManager->find($this->sessionManager->getContentPath($webspaceKey));

        if (null === $parent) {
            throw new \InvalidArgumentException(
                sprintf(
                    'Could not determine parent for document with title "%s" in webspace "%s"',
                    $document->getTitle(),
                    $webspaceKey
                )
            );
        }

        $document->setParent($parent);
    }
596861
public function visitFormAction(FormActionInterface $formAction)
    {
        $template = "form-action/{$formAction->getType()}.twig";

        return $this
            ->loadTemplate($template)
            ->render(
                [
                    "label" => $formAction->getLabel(),
                    "target" => $formAction->getTarget(),
                    "classes" => $formAction->getClasses(),
                    "data" => $formAction->getData(),
                ]
            );
    }
374360
public function preSubmit(FormEvent $event)
    {
        $data = $event->getData();
        $entity = $event->getForm()->getParent()->getConfig()->getDataClass();

        //if the remove checkbox is checked, clear the data
        if (isset($data[FileType::REMOVE_FIELDNAME]) &&  $data[FileType::REMOVE_FIELDNAME] === '1') {
            $event->setData(null);
            $data = null;
            return;
        }

        if (null !== ($file = $this->getUploadedFile($data))) {
            $this->validateFile($file, $event);
        } else {
            // nothing uploaded
            $hash = $data[FileType::HASH_FIELDNAME];
            $filename = $data[FileType::FILENAME_FIELDNAME];

            // check if there was a purgatory file (and the file is not tampered with)
            if (!empty($hash) && !empty($filename)
                && PurgatoryHelper::makeHash($event->getForm()->getPropertyPath(), $filename) === $hash
            ) {
                $path = $this->getPurgatoryFileManager()->getFilePath(
                    $entity,
                    $this->field,
                    $filename
                );

                $this->prepareData($data, $path, $event->getForm()->getPropertyPath());
                $event->setData($data);

                //use the original form data, so the field isn't empty
            } elseif ($event->getForm()->getData() !== null) {

                unset($data[FileType::HASH_FIELDNAME]);
                unset($data[FileType::FILENAME_FIELDNAME]);

                $originalFormData = $event->getForm()->getData();
                $path = $this->fileManager->getFilePath($entity, $this->field, $originalFormData);

                try {
                    $file = new File($path);
                    $data[FileType::UPLOAD_FIELDNAME] = $file;
                    $event->setData($data);
                } catch (FileNotFoundException $e) {
                    //do nothing
                }
            }
        }
    }
194210
private void handleInputElements(Eventable eventable) {
		CopyOnWriteArrayList<FormInput> formInputs = eventable.getRelatedFormInputs();

		for (FormInput formInput : formHandler.getFormInputs()) {
			if (!formInputs.contains(formInput)) {
				formInputs.add(formInput);
			}
		}

		formHandler.handleFormElements(formInputs);

	}