Giter Site home page Giter Site logo

monsieurbiz / syliuscmspageplugin Goto Github PK

View Code? Open in Web Editor NEW
35.0 8.0 22.0 1.55 MB

A Sylius plugin to manage your CMS pages

License: MIT License

PHP 76.84% JavaScript 3.60% Twig 10.63% Makefile 8.92%
sylius sylius-plugin cms hacktoberfest cms-pages

syliuscmspageplugin's Introduction

Banner of Sylius CMS Pages plugin

CMS Pages

CMS Page Plugin license Tests Status Security Status

This plugins allows you to add manage CMS pages using the Rich Editor.

If you want to know more about our editor, see the Rich Editor Repository

Example of CMS page creation

Installation

composer require monsieurbiz/sylius-cms-page-plugin

Change your config/bundles.php file to add the line for the plugin :

<?php

return [
    //..
    MonsieurBiz\SyliusCmsPagePlugin\MonsieurBizSyliusCmsPagePlugin::class => ['all' => true],
];

Then create the config file in config/packages/monsieurbiz_sylius_cms_page_plugin.yaml :

imports:
    - { resource: "@MonsieurBizSyliusCmsPagePlugin/Resources/config/config.yaml" }

Finally import the routes in config/routes/monsieurbiz_sylius_cms_page_plugin.yaml :

monsieurbiz_cms_page_admin:
    resource: "@MonsieurBizSyliusCmsPagePlugin/Resources/config/routing/admin.yaml"
    prefix: /%sylius_admin.path_name%

monsieurbiz_cms_page_shop:
    resource: "@MonsieurBizSyliusCmsPagePlugin/Resources/config/routing/shop.yaml"
    prefix: /{_locale}

Migrations

First, please run legacy-versioned migrations by using command :

bin/console doctrine:migrations:migrate

After migration, please create a new diff migration :

bin/console doctrine:migrations:diff

Then run it (if any) :

bin/console doctrine:migrations:migrate

Example of complete CMS Page

Admin form with preview

Admin full form

Front display

Front full display

Create custom elements

You can customize and create custom elements in your page.
In order to do that, you can check the Rich Editor custom element creation

SEO Friendly

You can define for every page the meta title, meta description and meta keywords.

Troubleshooting

Locale not found

We've added a new LocaleContext (LastChanceLocaleContext) because the locale isn't set in the request when the condition on the route is applied.
Therefore, if you still have an issue with multiple locales in your project, you may need to add another LocaleContext in order to find out your locale. The system will take care of the rest.

Contributing

You can open an issue or a Pull Request if you want! ๐Ÿ˜˜
Thank you!

syliuscmspageplugin's People

Contributors

delyriand avatar etienne-monsieurbiz avatar jacquesbh avatar jaroslavtyc avatar jordidekker avatar lanfisis avatar maximehuran avatar qhayat avatar roshyo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

syliuscmspageplugin's Issues

[Sylius 1.12] : Fatal Error on getAlias declaration

Hi,

I've just want to install your plugins in Sylius 1.12. During cache-clear, I've got this error:

!!  
!!  Fatal error: Declaration of MonsieurBiz\SyliusHomepagePlugin\DependencyInjection\MonsieurBizSyliusHomepageExtension::getAlias() must be compatible with Symfony\Component\DependencyInjection\Extension\Extension::getAlias(): string in /var/www/html/vendor/monsieurbiz/sylius-homepage-plugin/src/DependencyInjection/MonsieurBizSyliusHomepageExtension.php on line 37
!!  PHP Fatal error:  Declaration of MonsieurBiz\SyliusHomepagePlugin\DependencyInjection\MonsieurBizSyliusHomepageExtension::getAlias() must be compatible with Symfony\Component\DependencyInjection\Extension\Extension::getAlias(): string in /var/www/html/vendor/monsieurbiz/sylius-homepage-plugin/src/DependencyInjection/MonsieurBizSyliusHomepageExtension.php on line 37
!!  Symfony\Component\ErrorHandler\Error\FatalError {#274
!!    #message: "Compile Error: Declaration of MonsieurBiz\SyliusHomepagePlugin\DependencyInjection\MonsieurBizSyliusHomepageExtension::getAlias() must be compatible with Symfony\Component\DependencyInjection\Extension\Extension::getAlias(): string"
!!    #code: 0
!!    #file: "./vendor/monsieurbiz/sylius-homepage-plugin/src/DependencyInjection/MonsieurBizSyliusHomepageExtension.php"
!!    #line: 37
!!    -error: array:4 [
!!      "type" => 64
!!      "message" => "Declaration of MonsieurBiz\SyliusHomepagePlugin\DependencyInjection\MonsieurBizSyliusHomepageExtension::getAlias() must be compatible with Symfony\Component\DependencyInjection\Extension\Extension::getAlias(): string"
!!      "file" => "/var/www/html/vendor/monsieurbiz/sylius-homepage-plugin/src/DependencyInjection/MonsieurBizSyliusHomepageExtension.php"
!!      "line" => 37
!!    ]
!!  }
!!  

Probably due to a difference in declaration on the getAlias function of the Symfony 6 class Extension

RC14 OK - 1.0.0 KO

Hi

since upgrade from RC14 to 1.0.0 we have this issue :

Unable to find template "@SyliusAdmin/Grid/Field/_channels.html.twig" (looked into: /var/www/html/templates/bundles/SyliusAdminBundle, /var/www/html/vendor/sylius/sylius/src/Sylius/Bundle/AdminBundle/Resources/views).

any idea ?

CMS Plugin alongside SyliusAPI is leading to an error

I have an issue with your plugin used alongside SyliusApi (ApiPlatform) features when executing an API request:

Attempted to call an undefined method named \"checkPageSlug\" of class \"Symfony\\Component\\Routing\\RequestContext\".

In an API endpoint, I use the URI format to refer to other business entities. When the URI format is used in the API, the router is called to evaluate the URI, and the route "monsieurbiz_cms_page_shop" which has a wildcard (/{slug}) is evaluated.

Unfortunately, in this Router instance, Symphony's RequestContext (Symfony\Component\Routing\RequestContext) is used and not the decorated RequestContext of MonsieurBiz (MonsieurBiz\SyliusCmsPagePlugin\Routing\RequestContext). You can see here that it is directly instantiated.

A solution might be to test the context type in the route condition.
Thanks

Meta fields should not be mandatory

image

These fields should be optional.

The meta title has to be replaced my the title if empty. The description and the keywords can stay empty.

Error when editing page

Hi,

When I want to edit a page i've got this error:
The controller for URI "/admin/pages/1/edit" is not callable: Controller "monsieurbiz_cms_page.controller.page:updateAction" does neither exist as service nor as class.

However the page entity is well declared as a resource

UpperCase in meta fields on pageTranslation entity

Problems on Admin in index page with the render of template @SyliusAdmin\Crud/index.html.twig because metaTitle, metaKeywords, metaDescription are mapping with an underscore (meta_title, .... ) Solution is to rename the fields with underscore

<?php

declare(strict_types=1);

namespace App\Entity;

use MonsieurBiz\SyliusCmsPagePlugin\Entity\PageTranslation as BasePageTranslation;
use Doctrine\ORM\Mapping as ORM;

class PageTranslation extends BasePageTranslation
{

    /**
     * @ORM\Column(name="meta_title")
     */
    protected $metaTitle;

    /**
     * ORM\Column(name="meta_keywords")
     */
    protected $metaKeywords;

    /**
     * ORM\Column(name="meta_description")
     */
    protected $metaDescription;


}

remove LocalCode from the CmsPage url

I would want to remove the localCode in Url for the page created with this bundle, do you know a way to do this properly ? I tried but everytime i can't refind my CmsPage if i removed the localCode on my Sylius Application. Thanks for your help.

Does this bundle really need to depend on sylius/sylius?

I'm trying to install this bundle in a Monofony application. It fails because Monofony does not provider SyliusPluginTrait (as Monofony not depends on sylius/SyliusCoreBundle).

If SyliusCmsPagePlugin could directly depends on sylius/SyliusCoreBundle (and some other Sylius bundles if needed) instead of sylius/sylius, I guess it could allow the installation on Monofony.

cc @maximehuran @jacquesbh

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.