PHP code example of raffaelj / cockpit-uniqueslugs
1. Go to this page and download the library: Download raffaelj/cockpit-uniqueslugs library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
raffaelj / cockpit-uniqueslugs example snippets
return [
'app.name' => 'my app',
// unique slugs
'unique_slugs' => [
'collections' => [
'pages' => 'title',
'products' => 'name',
],
'localize' => [
'pages' => 'title',
'products' => 'name',
],
],
// ACL example
'groups' => [
'manager' => [
'cockpit' => [
'backend' => true,
],
'uniqueslugs' => [
'manage' => true,
],
],
],
];
return [
'app.name' => 'my app',
// unique slugs
'unique_slugs' => [
'slug_name' => 'slug', // default: "slug"
'placeholder' => 'page', // default: "entry"
'check_on_update' => true, // default: false, unique checks on each
// update (if user changes slug by hand)
'delimiter' => '|', // default: "|", is used for nested fields
'collections' => [
'pages' => 'title',
'products' => 'name',
'something' => [ // use multiple fields as fallbacks
'title',
'name',
'image|meta|title', // use nested fields for slugs
],
],
'localize' => [ // for localized fields, omitted if not set
'pages' => 'title', // field name without suffix ("_de")
'products' => 'name',
'something' => [ // use multiple fields as fallbacks
'title',
'name',
'image|meta|title', // use nested fields for slugs
],
],
],
// ACL example
'groups' => [
'manager' => [
'cockpit' => [
'backend' => true,
],
'uniqueslugs' => [
'manage' => true,
],
],
],
];