update theme
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Simon Vieille 2023-02-09 21:50:06 +01:00
parent 29a562441f
commit 385af624a6
Signed by: deblan
GPG key ID: 579388D585F70417
23 changed files with 150 additions and 195 deletions

4
.env Normal file
View file

@ -0,0 +1,4 @@
LIVE_RELOAD_SUPPORT=true
ADD_MODULES=mkdocs-material
DOCS_DIRECTORY=/app
FAST_MODE=false

View file

@ -2,6 +2,7 @@ pipeline:
build:
image: polinux/mkdocs
commands:
- pip install mkdocs-material
- mkdocs build
deploy:
image: eeacms/rsync

View file

@ -1,37 +1 @@
.wy-side-nav-search .icon::before {
content: ' ';
display: block;
background: url(/_static/img/logo.svg) no-repeat center center;
background-size: contain;
width: 100%;
height: 80px;
margin-bottom: 10px;
}
.wy-menu p.caption {
margin-top: 10px;
}
table {
margin-bottom: 15px;
}
td, th {
padding: 5px 10px;
}
td code {
border: 0 !important;
}
.wy-nav-content {
max-width: inherit;
}
.wy-nav-side {
background: #262e3d;
}
.wy-menu-vertical a:hover {
background: #1e2430;
}

View file

@ -28,9 +28,7 @@ Go the navigation and edit the tested node:
The event subscriber helps you to define each variation and the TTL.
```
// src/EventSubscriber/MyAbTestEventSubscriber.php
```php-inline title="src/EventSubscriber/MyAbTestEventSubscriber.php"
namespace App\EventSubscriber;
use App\Core\EventSubscriber\AbEventSubscriber as EventSubscriber;
@ -63,7 +61,7 @@ class MyAbTestEventSubscriber extends EventSubscriber
you can retrieve the test and the variation picked in PHP side and in template side.
```
```php-inline
use App\Core\Ab\AbContainerInterface;
public function foo(AbContainerInterface $testContainer)
@ -81,7 +79,7 @@ public function foo(AbContainerInterface $testContainer)
}
```
```
```twig
{% if ab_test_exists('example_test') %}
{% set test = ab_test('example_test') %}
{% set result = ab_test_result('example_test') %}
@ -95,9 +93,7 @@ public function foo(AbContainerInterface $testContainer)
If you need to perform an A/B test everywhere, you need to create a specific listener:
```
// src/EventListener/CustomAbListener.php
```php-inline title="src/EventListener/CustomAbListener.php"
namespace App\EventListener;
use App\Core\EventListener\AbListener as EventListener;
@ -126,9 +122,7 @@ class CustomAbListener extends EventListener
`CustomAbListener` must be registred:
```
# config/services.yml
```yaml title="config/services.yml"
services:
# ...

View file

@ -7,8 +7,7 @@ The default controller of a node is `App\Core\Controller\Site\PageController::sh
To create a custom controller, do this way:
```
// src/Controller/MyController.php
```php-inline title="src/Controller/MyController.php"
namespace App\Controller;
use App\Core\Controller\Site\PageController;
@ -30,7 +29,7 @@ class MyController extends PageController
Then edit `config/packages/app.yaml` and add your controller:
```
```yaml
core:
site:
controllers:
@ -41,8 +40,7 @@ core:
If your controller represents entities and if the associated node is visible in the sitemap, you can use a `App\Core\Annotation\UrlGenerator` in annotations and implement a generator. See the example below.
```
// src/UrlGenerator/MyEntityGenerator
```php-inline title="src/UrlGenerator/MyEntityGenerator"
namespace App\UrlGenerator;
use App\Core\Entity\Site\Node;
@ -84,8 +82,7 @@ class MyEntityGenerator
Then, the have to annotate the controller like this (note: `options` is optional):
```
// src/Controller/MyController.php
```php-inline title="src/Controller/MyController.php"
namespace App\Controller;
use App\Core\Annotation\UrlGenerator;
@ -104,7 +101,7 @@ class MyController extends PageController
Finally, update `config/services.yaml`:
```
```yaml
services:
# ...

View file

@ -6,8 +6,7 @@ The entity manager of Muprh is a proxy of the Doctrine's entity manager. It give
Entities must implements `App\Core\Entity\EntityInterface`.
```
// src/Entity/MyEntity.php
```php-inline title="src/Entity/MyEntity.php"
namespace App\Entity;
use App\Repository\MyEntityRepository;
@ -30,8 +29,7 @@ There are 2 entity managers which are services:
* `App\Core\Manager\EntityManager` used for all entities
* `App\Core\Manager\TranslatableEntityManager` used for translatable entities
```
// src/Controller/FooController.php
```php-inline title="src/Controller/FooController.php"
namespace App\Controller;
use App\Core\Manager\EntityManager
@ -62,8 +60,7 @@ class FooController
Events are dispatched before and after creation, update and deletion. All entities of Muprh use the entity manager.
```
// src/EventSubscriber/MyEntityEventSubscriber.php
```php-inline title="src/EventSubscriber/MyEntityEventSubscriber.php"
namespace App\EventSubscriber;
use App\Core\Entity\EntityInterface;

View file

@ -16,8 +16,7 @@ Simply run `php bin/console make:factory`.
## Usage
```
// src/Controller/FooController.php
```php-inline title="src/Controller/FooController.php"
namespace App\Controller;
use App\Factory\MyEntityFactory;

View file

@ -6,8 +6,7 @@ A Repository query is an abstraction of the doctrine repository.
Entities must implements `App\Core\Entity\EntityInterface`.
```
// src/Entity/MyEntity.php
```php-inline title="src/Entity/MyEntity.php"
namespace App\Entity;
use App\Repository\MyEntityRepository;
@ -34,8 +33,7 @@ Simply run `php bin/console make:repository-query`.
Each entity has its own repository query which is a service.
```
// src/Repository/MyEntityRepositoryQuery;
```php-inline title="src/Repository/MyEntityRepositoryQuery"
namespace App\Repository;
use App\Core\Repository\RepositoryQuery;
@ -66,8 +64,7 @@ class MyEntityRepositoryQuery extends RepositoryQuery
You are able to find entities in an easy way, without knowing the identification variable and without creating a query builder.
```
// src/Controller/FooController.php
```php-inline title="src/Controller/FooController.php"
namespace App\Controller;
use App\Repository\MyEntityRepositoryQuery
@ -93,7 +90,7 @@ class FooController
## Custom methods
```
```php-inline
// ...
class MyEntityRepositoryQuery extends RepositoryQuery
@ -113,7 +110,7 @@ class MyEntityRepositoryQuery extends RepositoryQuery
}
```
```
```php-inline
$entities = $query->create()
->filterByFoo($foo, $bar)
->find();
@ -123,6 +120,6 @@ $entities = $query->create()
You can paginate entities (`Knp\Component\Pager\Pagination\PaginationInterface`):
```
```php-inline
$pager = $query->create()->paginate($page, $maxPerPage);
```

View file

@ -13,7 +13,7 @@
Depending of you environment, PHP and composer could be located in specific paths.
Defines theme with environment vars:
```
```bash
export PHP_BIN=/usr/bin/php
export COMPOSER_BIN=/usr/bin/composer
export NPM_BIN=/usr/bin/npm
@ -22,7 +22,7 @@ export YARN_BIN=/usr/bin/yarn
Create your project:
```
```bash
"$COMPOSER_BIN" create-project murph/murph-skeleton my_project ^1
```

View file

@ -9,8 +9,7 @@ A setting's value is stored in json so a value could be a string, a boolean, an
See the example below.
```
// src/EventSubscriber/SettingEventSubscriber.php
```php-inline title="src/EventSubscriber/SettingEventSubscriber.php"
namespace App\EventSubscriber;
use App\Core\Event\Setting\SettingEvent;
@ -72,8 +71,7 @@ Result:
Settings are accessible using `App\Core\Setting\SettingManager` which is a service.
```
// src/Controller/FooController.php
```php-inline title="src/Controller/FooController.php"
namespace App\Controller;
use App\Core\Setting\SettingManager;
@ -94,7 +92,7 @@ class FooController
In a template, you can use the function `setting`:
```
```twig
Font color: {{ setting('app_font_color') }}<br>
Background color: {{ setting('app_background_color') }}<br>
Maintenance enabled: {{ setting('app_maintenance_enabled') ? 'Yes' : 'No' }}<br>
@ -104,8 +102,7 @@ Maintenance enabled: {{ setting('app_maintenance_enabled') ? 'Yes' : 'No' }}<br>
Settings are accessible using `App\Core\Setting\SettingManager` which is a service.
```
// src/Controller/FooController.php
```php-inline title="src/Controller/FooController.php"
namespace App\Controller;
use App\Core\Setting\SettingManager;
@ -132,7 +129,7 @@ You can also edit them from UI:
You can add options using this way:
```
```php-inline
$event->setOption('view', 'large');
```

View file

@ -9,8 +9,7 @@ A setting's value is stored in json so a value could be a string, a boolean, an
See the example below.
```
// src/EventSubscriber/NavigationSettingEventSubscriber.php
```php-inline title="src/EventSubscriber/NavigationSettingEventSubscriber.php"
namespace App\EventSubscriber;
use App\Core\Event\Setting\NavigationSettingEvent;
@ -73,8 +72,7 @@ Result:
Settings are accessible using `App\Core\Setting\NavigationSettingManager` which is a service.
```
// src/Controller/FooController.php
```php-inline title="src/Controller/FooController.php"
namespace App\Controller;
use App\Core\Setting\NavigationSettingManager;
@ -95,7 +93,7 @@ class FooController
In a template, you can use the function `navigation_setting`:
```
```twig
Tracker code: {{ navigation_setting(_navigation, 'nav_tracker_code') }}<br>
Contact email: {{ navigation_setting('my_nav', 'nav_contact_email') }}<br>
```
@ -104,8 +102,7 @@ Contact email: {{ navigation_setting('my_nav', 'nav_contact_email') }}<br>
Settings are accessible using `App\Core\Setting\NavigationSettingManager` which is a service.
```
// src/Controller/FooController.php
```php-inline title="src/Controller/FooController.php"
namespace App\Controller;
use App\Core\Setting\NavigationSettingManager;

View file

@ -2,8 +2,7 @@
Tasks are scripts executabled from UI. The creation of tasks is based on events.
```
// src/EventSubscriber/MyTaskEventSubscriber.php
```php-inline title="src/EventSubscriber/MyTaskEventSubscriber.php"
namespace App\EventSubscriber;
use App\Core\Event\Task\TaskInitEvent;

View file

@ -26,7 +26,7 @@ By default, these variables are given to a CMS view:
You can access a page's blocks this way:
```
```twig
{% set myBlock = _page.myBlock.value %}
{{ myBlock }}
@ -49,7 +49,7 @@ Murph has somes twig functions to manage URLs:
A node may have a disabled URL:
```
```twig
{% if not node.disableUrl %}
{% set path = safe_node_path(node) %}
{% set url = safe_node_url(node) %}
@ -58,7 +58,7 @@ A node may have a disabled URL:
When the navigation has several domains, you can specify the domain:
```
```twig
{% set path = safe_node_path(node, {_domain: _domain}) %}
{% set url = safe_node_url(node, {_domain: _domain}) %}
```

View file

@ -24,7 +24,7 @@ The routing tab is very important. It allows you to define all parameters relate
To add a controller in the list, edit `config/packages/app.yaml`:
```
```yaml
core:
site:
controllers:

View file

@ -3,8 +3,7 @@
A page is a doctrine entity that contains blocks and form builder.
You can run `php bin/console make:page` and generate a new page in an interactive way.
```
// src/Entity/Page/YourPage.php
```php-inline title="src/Entity/Page/YourPage.php"
namespace App\Entity\Page;
use App\Core\Entity\Site\Page\Block;
@ -13,9 +12,7 @@ use App\Core\Form\Site\Page\TextBlockType;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Form\FormBuilderInterface;
/**
* @ORM\Entity
*/
#[ORM\Entity]
class YourPage extends Page
{
public function buildForm(FormBuilderInterface $builder, array $options)
@ -50,7 +47,7 @@ class YourPage extends Page
Then edit `config/packages/app.yaml` and add your page:
```
```yaml
core:
site:
pages:
@ -85,7 +82,7 @@ core:
In the getter, you must specify the block:
```
```php-inline
use App\Core\Entity\Site\Page\FileBlock;
public function getMyBlock(): Block
@ -116,7 +113,7 @@ public function getMyBlock(): Block
In the getter, you must specify the block:
```
```php-inline
use App\Core\Entity\Site\Page\FileBlock;
public function getMyBlock(): Block
@ -129,7 +126,7 @@ public function getMyBlock(): Block
`App\Core\Form\Site\Page\CollectionBlockType` will a render a symfony `CollectionType ` with availabity to add and remove elements.
```
```php-inline
use App\Core\Entity\Site\Page\CollectionBlock;
public function getMyBlock(): Block
@ -142,8 +139,7 @@ public function getMyBlock(): Block
When a page is being edited, the options can be set as follows:
```
// src/EventSubscriber/PageEventSubscriber.php
```php-inline title="src/EventSubscriber/PageEventSubscriber.php"
namespace App\EventSubscriber;
use App\Core\Event\Page\PageEditEvent;

View file

@ -13,8 +13,8 @@ When the entity is created or updated, `createdAt` and `updatedAt` are automatic
### Usage
```
// App/Entity/FooEntity;
```php-inline title="src/Entity/FooEntity.php"
namespace App/Entity;
use use App\Core\Entity\EntityInterface;
use Doctrine\ORM\Mapping as ORM;
@ -24,10 +24,8 @@ use App\Core\Entity\EntityInterface;
use App\Repository\FooRepository;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=FooRepository::class)
* @ORM\HasLifecycleCallbacks
*/
#[ORM\Entity(repositoryClass: FooRepository::class)]
#[ORM\HasLifecycleCallbacks]
class FooEntity implements EntityInterface
{
use Timestampable;

View file

@ -8,7 +8,7 @@ Editor.js is fully integrated in Murph as form types.
## Classic form
```
```php-inline
// src/Form/ExampleType.php
namespace App\Form\ExampleType;
@ -34,7 +34,7 @@ class ExampleType extends AbstractType
Modified data should return stringified JSON array if empty:
```
```php-inline
public function getMyField(): string
{
if (empty($this->myField)) {
@ -47,16 +47,14 @@ public function getMyField(): string
## Page form
```
```php-inline
// src/Entity/Page/YourPage.php
namespace App\Entity\Page;
use App\Core\Entity\Site\Page\Block;
use App\Core\Form\Site\Page\EditorJsTextareaBlockType;
/**
* @ORM\Entity
*/
#[@ORM\Entity]
class YourPage extends Page
{
public function buildForm(FormBuilderInterface $builder, array $options)
@ -117,7 +115,7 @@ If you want to render specific blocks: `{{ value|editorjs_to_html(['paragraph',
Block have default templates stored in `vendor/murph/murph-core/src/core/Resources/views/editorjs`.
They can be simply overridden in `config/packages/app.yaml`:
```
```yaml
core:
editor_js:
blocks:

View file

@ -8,7 +8,7 @@ GrapesJS is fully integrated in Murph as form types.
## Classic form
```
```php-inline
// src/Form/ExampleType.php
namespace App\Form\ExampleType;
@ -34,16 +34,14 @@ class ExampleType extends AbstractType
## Page form
```
```php-inline
// src/Entity/Page/YourPage.php
namespace App\Entity\Page;
use App\Core\Entity\Site\Page\Block;
use App\Core\Form\Site\Page\GrapesJsBlockType;
/**
* @ORM\Entity
*/
#[ORM\Entity]
class YourPage extends Page
{
public function buildForm(FormBuilderInterface $builder, array $options)
@ -88,9 +86,7 @@ There are 3 modes:
To specify a mode, you must define the attribute `data-grapesjs`:
```
// src/Form/ExampleType.php
```php-inline title="src/Form/ExampleType.php"
$builder->add(
'myField',
GrapesJsType::class,
@ -103,8 +99,7 @@ $builder->add(
]
);
// src/Entity/Page/YourPage.php
```php-inline title="src/Entity/Page/YourPage.php"
$builder->add(
'myBlock',
GrapesJsBlockType::class,

View file

@ -6,8 +6,7 @@ TinyMCE gives you total control over your rich text editing. It's fully integrat
## Classic form
```
// src/Form/ExampleType.php
```php-inline title="src/Form/ExampleType.php"
namespace App\Form\ExampleType;
use App\Core\Form\Type\TinymceTextareaType;
@ -32,16 +31,13 @@ class ExampleType extends AbstractType
## Page form
```
// src/Entity/Page/YourPage.php
```php-inline title="src/Entity/Page/YourPage.php"
namespace App\Entity\Page;
use App\Core\Entity\Site\Page\Block;
use App\Core\Form\Site\Page\TinymceTextareaBlockType;
/**
* @ORM\Entity
*/
#[ORM\Entity]
class YourPage extends Page
{
public function buildForm(FormBuilderInterface $builder, array $options)
@ -85,9 +81,7 @@ There are 2 predefined modes:
To specify a mode, you must define the attribute `data-tinymce`:
```
// src/Form/ExampleType.php
```php-inline title="src/Form/ExampleType.php"
$builder->add(
'myField',
TinymceTextareaType::class,
@ -99,9 +93,9 @@ $builder->add(
],
]
);
```
// src/Entity/Page/YourPage.php
```php-inline title="src/Entity/Page/YourPage.php"
$builder->add(
'myBlock',
TinymceTextareaBlockType::class,
@ -119,9 +113,7 @@ $builder->add(
To custom the editor, see the example below:
```
// assets/js/admin.js
```javascript title="assets/js/admin.js"
import '../../vendor/murph/murph-core/src/core/Resources/assets/js/admin.js'
window.tinymce.language = 'fr_FR'
@ -142,9 +134,9 @@ window.tinymce.murph.modes.myCustomMode = {
],
content_style: '...'
}
```
// src/Form/ExampleType.php
```php-inline title="src/Form/ExampleType.php"
$builder->add(
'myField',
TinymceTextareaType::class,
@ -156,9 +148,9 @@ $builder->add(
],
]
);
```
// src/Entity/Page/YourPage.php
```php-inline title="src/Entity/Page/YourPage.php"
$builder->add(
'myBlock',
TinymceTextareaBlockType::class,

View file

@ -3,7 +3,7 @@
`App\Core\File\FileAttribute::handleFile` transforms a file path to an instance of `Symfony\Component\HttpFoundation\File\File`. You can specify another class if needed.
If the path is `null` or if the file does not exist, it returns `null`.
```
```php-inline
use App\Core\File\FileAttribute;
use App\Foo\Bar;

View file

@ -2,7 +2,7 @@
`App\Core\Form\FileUploadHandler` is a service and helps you to upload a file. See example below.
```
```php-inline
use App\Core\Form\FileUploadHandler;
use App\Entity\Foo;
use App\Form\FooType;

View file

@ -21,7 +21,7 @@ Useful methods:
Exemple:
```
```php-inline
use App\Core\Notification\MailNotifier;
use App\Repository\UserRepositoryQuery;

View file

@ -1,47 +1,77 @@
site_name: Documentation of Murph
# extra_css:
# - /_static/css/extra.css
plugins:
- search
theme:
name: readthedocs
extra_css:
- /_static/css/extra.css
name: material
logo: /_static/img/logo.svg
favicon: /_static/img/logo.svg
features:
- content.code.copy
palette:
- scheme: default
toggle:
icon: material/brightness-7
name: Switch to dark mode
- scheme: slate
toggle:
icon: material/brightness-4
name: Switch to light mode
markdown_extensions:
- pymdownx.highlight:
anchor_linenums: true
extend_pygments_lang:
- name: php-inline
lang: php
options:
startinline: true
- pymdownx.tabbed:
alternate_style: true
- pymdownx.snippets
- pymdownx.superfences
- pymdownx.highlight
- pymdownx.inlinehilite
nav:
- Overview: index.md
- 'Sources codes': sources.md
- Installation: install.md
- 'Tree manager':
- Overview: tree/index.md
- Navigation: tree/navigation.md
- Menu: tree/menu.md
- Node: tree/node.md
- Page: tree/page.md
- Controller:
- Controller: controller.md
- Template:
- Template: template.md
- Entities:
- 'Entity Manager': entities/em.md
- 'Repository Query': entities/query.md
- Factory: entities/factory.md
- CRUD:
- Overview: crud/index.md
- Generator: crud/generator.md
- Configuration: crud/configuration.md
- Settings:
- 'Global settings': settings/global.md
- 'Navigation settings': settings/navigation.md
- Editors:
- TinyMCE: utils/editors/tinymce.md
- GrapesJS: utils/editors/grapesjs.md
- Editor.js: utils/editors/editorjs.md
- Utils:
- Cache Manager: utils/cache.md
- Doctrine: utils/doctrine.md
- File upload handler: utils/file_handler.md
- File attribute: utils/file_attribute.md
- Mail notifier: utils/mail.md
- Slug: utils/slug.md
- "A/B Testing":
- 'A/B Testing': abtesting.md
- Users:
- Users: users.md
- Tasks:
- Tasks: tasks.md
- Overview: index.md
- 'Sources codes': sources.md
- Installation: install.md
- 'Tree manager':
- Overview: tree/index.md
- Navigation: tree/navigation.md
- Menu: tree/menu.md
- Node: tree/node.md
- Page: tree/page.md
- Controller: controller.md
- Template: template.md
- Entities:
- 'Entity Manager': entities/em.md
- 'Repository Query': entities/query.md
- Factory: entities/factory.md
- CRUD:
- Overview: crud/index.md
- Generator: crud/generator.md
- Configuration: crud/configuration.md
- Settings:
- 'Global settings': settings/global.md
- 'Navigation settings': settings/navigation.md
- Editors:
- TinyMCE: utils/editors/tinymce.md
- GrapesJS: utils/editors/grapesjs.md
- Editor.js: utils/editors/editorjs.md
- Utils:
- Cache Manager: utils/cache.md
- Doctrine: utils/doctrine.md
- File upload handler: utils/file_handler.md
- File attribute: utils/file_attribute.md
- Mail notifier: utils/mail.md
- Slug: utils/slug.md
- "A/B Testing": abtesting.md
- Users: users.md
- Tasks: tasks.md