src/Component/Frontend/StructureModal/StructureModal.php
public function handleOpen(string $recipeSlug, int $structureId = NULL, bool $isNew = FALSE) : void
    {
        if ($this->presenter->isAjax() && $this->presenter->user->isAllowed(StructureAuthorizator::RES_STRUCTURE_MODAL))
        {
            $recipeSlugString = $recipeSlug;
            $this->recipeSlugString = $recipeSlugString;

            $recipeSlug = $this->getRecipeSlug();

            if ($recipeSlug)
            {
                if ($isNew)
                {
                    if ($recipeSlug->getRecipe()->isDynamic())
                    {
                        $count = $this->structureRepository->countByRecipeSlugAndPage($recipeSlugString, $this->page);
                    }
                    else
                    {
                        $count = $this->structureRepository->countByRecipeSlug($recipeSlugString);
                    }

                    if ($count >= $recipeSlug->getRecipe()->getMaxInstances() && $recipeSlug->getRecipe()->getMaxInstances() !== 0)
                    {
                        $message = $recipeSlug->getRecipe()->isDynamic() ? 'na této stránce' : '';

                        $this->presenter->notificationAjax(
                            'Dosažení limitu',
                            "Pro položku '{$recipeSlug->getRecipe()->getName()} [slug: {$recipeSlugString}]' byl {$message} dosažen limit. Maximální počet položek: {$recipeSlug->getRecipe()->getMaxInstances()}.",
                            'error',
                            TRUE
                        );
                    }
                }

                if ($structureId !== NULL)
                {
                    $structure = $this->getStructure();

                    if (!$structure)
                    {
                        $this->presenter->notificationAjax(
                            'Položka neexistuje',
                            "Položka s id '{$structureId}' neexistuje.",
                            'error',
                            TRUE
                        );
                    }
                }

                $this->presenter->handleModalToggle('show', '#wakers_structure_structure_modal', FALSE);
                $this->onOpen();
            }
            else
            {
                $this->presenter->notificationAjax('Chyba', "Předpis se slugem '{$recipeSlugString}' neexistuje", 'error', TRUE);
            }
        }
    }
public function handleOpen(string $recipeSlug, int $structureId = NULL, bool $isNew = FALSE) : void
    {
        if ($this->presenter->isAjax() && $this->presenter->user->isAllowed(StructureAuthorizator::RES_STRUCTURE_MODAL))
        {
            $recipeSlugString = $recipeSlug;
            $this->recipeSlugString = $recipeSlugString;

            $recipeSlug = $this->getRecipeSlug();

            if ($recipeSlug)
            {
                if ($isNew)
                {
                    if ($recipeSlug->getRecipe()->isDynamic())
                    {
                        $count = $this->structureRepository->countByRecipeSlugAndPage($recipeSlugString, $this->page);
                    }
                    else
                    {
                        $count = $this->structureRepository->countByRecipeSlug($recipeSlugString);
                    }

                    if ($count >= $recipeSlug->getRecipe()->getMaxInstances() && $recipeSlug->getRecipe()->getMaxInstances() !== 0)
                    {
                        $message = $recipeSlug->getRecipe()->isDynamic() ? 'na této stránce' : '';

                        $this->presenter->notificationAjax(
                            'Dosažení limitu',
                            "Pro položku '{$recipeSlug->getRecipe()->getName()} [slug: {$recipeSlugString}]' byl {$message} dosažen limit. Maximální počet položek: {$recipeSlug->getRecipe()->getMaxInstances()}.",
                            'error',
                            TRUE
                        );
                    }
                }

                if ($structureId !== NULL)
                {
                    $structure = $this->getStructure();

                    if (!$structure)
                    {
                        $this->presenter->notificationAjax(
                            'Položka neexistuje',
                            "Položka s id '{$structureId}' neexistuje.",
                            'error',
                            TRUE
                        );
                    }
                }

                $this->presenter->handleModalToggle('show', '#wakers_structure_structure_modal', FALSE);
                $this->onOpen();
            }
            else
            {
                $this->presenter->notificationAjax('Chyba', "Předpis se slugem '{$recipeSlugString}' neexistuje", 'error', TRUE);
            }
        }
    }
Open add modal (edit existing structure)
@param string $recipeSlug
@param int $structureId
@param bool $isNew
@throws \Propel\Runtime\Exception\PropelException