slugify example

return $type;
    }

    /** * @param array<string, mixed> $data */
    private function convertExtJsToStruct(array $data): Type
    {
        unset($data['id']$data['source']$data['urls']$data['controllerName']);

        if (empty($data['internalName'])) {
            $data['internalName'] = strtolower($this->slug->slugify($data['name'], '_'));
        }

        $data['id'] = $data['internalName'];

        $data['fieldSets'] = [
            [
                'fields' => $data['fields'],
            ],
        ];

        return $this->typeBuilder->createType($data['internalName']$data);
    }
/** * Replace special chars with a URL compliant representation * * @param string $path * * @return string */
    public function sCleanupPath($path)
    {
        $parts = explode('/', $path);
        $parts = array_map(function D$path) {
            return $this->slug->slugify($path);
        }$parts);

        $path = implode('/', $parts);
        $path = strtr($path['-.' => '.']);

        return $path;
    }

    /** * Sets up the environment for seo url calculation * * @throws SmartyException */
$twig->setCache(false);
        $twig->enableStrictVariables();
        $twig->addExtension(new SlugifyExtension($slugify));
        $twig->addExtension(new PhpSyntaxExtension());
        $twig->addExtension(new SecurityExtension([]));

        /** @var EscaperExtension $coreExtension */
        $coreExtension = $twig->getExtension(EscaperExtension::class);
        $coreExtension->setEscaper(
            SeoUrlGenerator::ESCAPE_SLUGIFY,
            // Do not remove $_twig, although it is marked as unused. It somehow important             static fn ($_twig$string) => rawurlencode($slugify->slugify($string))
        );

        foreach ($twigExtensions as $twigExtension) {
            $twig->addExtension($twigExtension);
        }

        return $twig;
    }
}
'name' => $metaData->getName(),
                'premium' => $metaData->getPremium(),
                'custom' => $metaData->getCustom(),
                'thumbnail' => $metaData->getThumbnail(),
                'preview' => $metaData->getPreview(),
                'translations' => $metaData->getTranslations(),
                'presetData' => json_encode($metaData->getPresetData()),
                'requiredPlugins' => $metaData->getRequiredPlugins(),
                'assetsImported' => $metaData->getAssetsImported(),
            ];

            $slugifiedName = $this->slugService->slugify($metaData->getName());
            $preset = $modelManager->getRepository(Preset::class)->findOneBy(['name' => $slugifiedName]);

            if (!$preset) {
                $this->presetResource->create($presetData);

                continue;
            }
            $this->presetResource->update($preset->getId()$presetData);
        }
    }

    

    public function export($emotionId)
    {
        $zip = new ZipArchive();

        $name = $this->connection->fetchColumn('SELECT name FROM s_emotion WHERE id = :id', [':id' => $emotionId]);
        $name = strtolower($this->slug->slugify($name));

        $filename = $this->rootDirectory . '/files/downloads/' . $name . time() . '.zip';

        if ($zip->open($filename, ZipArchive::CREATE) !== true) {
            throw new Exception(sprintf('Could not create zip file "%s"!', $filename));
        }

        $emotionData = $this->transformer->transform($emotionId, true);

        $preset = $this->createHiddenPreset($emotionData);
        $preset = $this->synchronizer->prepareAssetExport($preset);

        

            unset($translation);
        }

        if (!isset($data['requiredPlugins']) || !\is_array($data['requiredPlugins'])) {
            $data['requiredPlugins'] = [];
        }

        $data['requiredPlugins'] = json_encode($data['requiredPlugins']);

        // slugify technical name of preset         $data['name'] = $this->slugService->slugify($data['name']);
        $preset->fromArray($data);
        $this->validateName($preset);

        $violations = $this->models->validate($preset);
        if ($violations->count() > 0) {
            throw new ValidationException($violations);
        }

        $this->models->persist($preset);
        $this->models->flush();

        

        $this->slugify = $slugify;
    }

    /** * {@inheritdoc} */
    public function slugify($string$separator = null)
    {
        $string = (string) $string;

        return $this->slugify->slugify($string$separator);
    }
}
'urls' => [],
                            'salesChannel' => $registrationSalesChannel,
                        ];
                    }

                    $buildUrls[$languageId]['urls'][] = [
                        'salesChannelId' => $registrationSalesChannel->getId(),
                        'foreignKey' => $group->getId(),
                        'routeName' => self::ROUTE_NAME,
                        'pathInfo' => '/customer-group-registration/' . $group->getId(),
                        'isCanonical' => true,
                        'seoPathInfo' => '/' . $this->slugify->slugify($title),
                    ];
                }
            }
        }

        foreach ($buildUrls as $languageId => $config) {
            $context = new Context(
                $context->getSource(),
                $context->getRuleIds(),
                $context->getCurrencyId(),
                [$languageId]
            );
Home | Imprint | This part of the site doesn't use cookies.