sevengroupfrance / sulu-duplicate-articles-bundle
1.2.2
2023-07-19 11:27 UTC
README
Inspired by this pull request.
What is this bundle's goal?
Importing a custom fonctionality into sulu, in this example, a custom content type.
This bundle will import a custom toggle from the react-switch npm package.
Installation
- Go to your
assets/admin
folder and install the react-switch npm packagenpm install react-switch
. - Download the package in your project with the following command line:
composer require sevengroupfrance/sulu-duplicate-articles-bundle
. - In
config/bundles.php
add the following code:
SevenGroupFrance\SuluDuplicateArticlesBundle\DuplicateArticlesBundle::class => ['all' => true]
. - In
assets/admin/package.json
, add the following line in the "dependencies" object:
"sulu-duplicate-articles-bundle": "file:node_modules/@sulu/vendor/sevengroupfrance/sulu-duplicate-articles-bundle/src/Resources/js"
. - In
assets/admin
,npm install
to initialize the bundle's symlink directory. - In
assets/admin/index.js
, add this line:
import 'sulu-duplicate-articles-bundle'
. - In
assets/admin
,npm run watch
ornpm run build
- In your environment .env, Add the variable taht'll hold the type of contents as defined in your xml in this variable : 'DUPLICATE_CONTENT_LIST="content1,content2,content3"'
- In your config/routes/sulu_admin.yaml, add the routing logic that'll target your bundle's logic : 'duplicate_content: path: /admin/api/duplicate-content controller: SevenGroupFrance\SuluDuplicateArticlesBundle\Controller\Admin\ContentController::duplicateContent
For further customisation, please refer to the official page
Use in your tAdmin view
Once installed, you can check a any content on the list view page ( only one ) and click the button to start the cloning process
The page will then reload and your new content will be available as an unpublished draft named copie " my_content_title"
Be careful you can for now clone only one type of content at the time and only in the same content list. It may evolve in a later date.