hasForm example



    /** * Helper function to remove a plugins form or only its translations (if removeData == false) * * @param bool $removeData * * @throws Exception */
    private function removeForm(Shopware_Components_Plugin_Bootstrap $bootstrap$removeData = true)
    {
        if (!$bootstrap->hasForm()) {
            return;
        }

        if ($removeData) {
            $em = $this->Application()->Models();
            $form = $bootstrap->Form();

            if ($form->getId()) {
                $em->remove($form);
            } else {
                $em->detach($form);
            }

    final public function Forms(): EntityRepository
    {
        return Shopware()->Models()->getRepository(Form::class);
    }

    /** * Returns plugin form */
    final public function Form(): Form
    {
        if (!$this->hasForm()) {
            $this->form = $this->initForm();
        }

        if ($this->form === null) {
            throw new RuntimeException('Plugin form was not initialized correctly');
        }

        return $this->form;
    }

    final public function hasForm(): bool
    {
Home | Imprint | This part of the site doesn't use cookies.