spiral / pages
Vault component dedicated to use dynamic pages.
Requires
- php: >=7.0
- oscarotero/psr7-middlewares: ^3.20
- spiral/auth: ^0.9.1
- spiral/framework: ^1.0
- spiral/listing: ^0.9.4
- spiral/vault: ^0.9.7
Requires (Dev)
- mockery/mockery: dev-master
- phpunit/phpunit: ~6.0
- symfony/dom-crawler: ^3.2
This package is not auto-updated.
Last update: 2024-02-03 23:50:01 UTC
README
Spiral CMS pages module. Allows to create dynamic cms pages and manage them.
Pages contain all previous changes in revisions history.
Installation
composer require spiral/pages
spiral register spiral/pages
Need to place navigation links in admin panel? Use example code below:
'pages' => [
'title' => 'Pages',
'icon' => 'description',
'requires' => 'vault.pages',
'items' => [
'pages' => ['title' => 'CMS Pages'],
/*{{navigation.pages}}*/
]
],
Usage
In pages config please define page
value - a path to your view file where you will include spiral page tags:
<?php
//Config example
return [
...
'page' => 'spiral-cms-page',
...
];
Example of page view is:
<dark:use path="pages:cms/*" prefix="pages:"/>
<?php
/** @var \Spiral\Pages\Database\Page $page */
?>
<!DOCTYPE html>
<html>
<head>
<pages:meta page="<?= $page ?>"/>
</head>
<body>
<pages:page page="<?= $page ?>"/>
</body>
</html>
pages:meta
tag supports default values, pass keywords
or description
with default values as attributes, tag context will be used as custom html:
<pages:meta page="<?= $page ?>" description="default description" keywords="default,keywords">
<meta name="tags" content="default tags">
</pages:meta>
Only pages in active status are visible for users.
Admins can view them in draft when is is allowed, they need to have viewDraftPermission
defined in pages config.
In this case they will see some notice that this page currently in draft, you can disable notice by
showDraftNotice
value in pages config.
On-page editing (waiting writeaway module to be finished)
If you have enough permissions (editCMSPermission
value in pages config) you may use inline editor to change page content.
All you need is:
- install
writeaway/writeaway
npm module - define get/set urls for meta data editor and source data editor
todo
- Add visual editor in admin panel