Open Sunil66maurya opened 2 years ago
You add all ReferenceableContent stuff like in Product add a form extension like: ( see https://symfony.com/doc/current/form/create_form_type_extension.html )
<?php
declare(strict_types=1);
namespace App\Form\Extension;
use Sylius\Bundle\TaxonomyBundle\Form\Type\TaxonType;
use Symfony\Component\Form\AbstractTypeExtension;
use Symfony\Component\Form\Extension\Core\Type\ColorType;
use Symfony\Component\Form\FormBuilderInterface;
use Dedi\SyliusSEOPlugin\Form\Extension\AbstractReferenceableTypeExtension;
final class TaxonTypeExtension extends AbstractReferenceableTypeExtension
{
public function getExtendedType()
{
return TaxonType::class;
}
public static function getExtendedTypes(): array
{
return [TaxonType::class];
}
}
Then make a test in the metatags block mentioned here https://github.com/dediagency/sylius-seo-plugin/blob/master/doc/INSTALL.md#add-twig-events, so the taxon is used on the taxon page instead of product or channel,
For example (found the way to get the taxon on stackoverflow)
{% block title %}
{{ sylius_template_event('dedi_sylius_seo_plugin.title', { resource: products.definition.driverConfiguration.repository.arguments.taxon ?? product ?? sylius.channel }) }}
{% endblock %}
And I forgot to tell you, you should add the form field in twig
So add:
# config/packages/sylius.yaml
sylius_ui:
events:
sylius.admin.taxon.create.form:
blocks:
dedi_seo_taxon: "admin/taxon_seo.html.twig" # this is just an example (the file is in bundles/admin/taxon_seo.html.twig)
sylius.admin.taxon.update.form:
blocks:
dedi_seo_taxon: "admin/taxon_seo.html.twig"
{# bundles/admin/taxon_seo.html.twig #}
{{ form_row(form.referenceableContent) }}
Hi, I installed the plugin and it works fine for Product and channel also. Is there any way to customize seo on taxon page also like product page?