2017 © Pedro Peláez
 

library pieces

Spiral Framework Pieces Module

image

spiral/pieces

Spiral Framework Pieces Module

  • Tuesday, August 8, 2017
  • by wolfy-j
  • Repository
  • 4 Watchers
  • 0 Stars
  • 91 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 22 Versions
  • 2 % Grown

The README.md

Pieces Module

This module provide ability to store page pieces data in database (currently ORM only) and access it via Web-API. Also it's compiles two versions of views: one for site editor and one for common site user. The functionality can be sometimes useful especially with something like WriteAway., (*1)

Installation

$ composer require spiral/pieces
$ ./spiral register spiral/pieces
$ ./spiral up

Add Bootloader

const LOAD = [
    //...
    \Spiral\Pieces\Bootloaders\PiecesBootloaders::class,
]

Configure permissions

Check app/config/modules/pieces.php for details., (*2)

Metadata

There are two alternatives to include metadata to your pages: "static" and "runtime". First one will fully compile during views compilation and there will be no requests to database during page load. Second one will not., (*3)

<dark:use path="pieces/meta" as="pieces:meta"/>

<pieces:meta title="Foo" description="Bar" keywords="Baz">
  <meta name="foo" content="bar">
</pieces:meta>

The code above is "static" metadata. You can optionally pass some defaults: title, description, keywords arguments and put custom default html (see code above)., (*4)

If you need something a bit more complex than dumb static pages, then currently you need to use "runtime" metadata. In opposite to "static" metadata you should pass namespace, view and code arguments, but title, description and keywords are still optional., (*5)

<dark:use path="pieces/runtime-meta" as="pieces:meta"/>



<pieces:meta title="<?= $entity->title ?>" description="<?= $entity->description ?>"
             namespace="<?= $this->namespace #compile ?>" view="<?= $this->view #compile ?>"
             code="<?= $entity->id ?>">
    <meta name="foo" content="bar">
</pieces:meta>

It's useful to note, that both alternatives will append (in editor mode):, (*6)

<script>
  window.metadata = <?= json_encode($meta) ?>;
</script>

to help you with frontend editor setup., (*7)

If you don't like the behaviour you're always free to write your own code... And make a PR. :-), (*8)

Pieces

Currently there's only "static" pieces., (*9)

<dark:use path="pieces/piece" as="pieces:piece"/>

<pieces:piece name="sample-piece">
  Piece content.
</pieces:piece>

In editor mode content of the piece will be wrapped in div like this:, (*10)

<div data-piece="html" data-id="sample-piece">
  Piece content.
</div>

The Versions

08/08 2017

dev-master

9999999-dev

Spiral Framework Pieces Module

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dmitry Mironov
by Anton Titov
by Lev Seleznev

08/08 2017

v1.0.8

1.0.8.0

Spiral Framework Pieces Module

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dmitry Mironov
by Anton Titov
by Lev Seleznev

08/08 2017

v1.0.7

1.0.7.0

Spiral Framework Pieces Module

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dmitry Mironov
by Anton Titov
by Lev Seleznev

08/08 2017

dev-feature/view-cache-targeting-recompile

dev-feature/view-cache-targeting-recompile

Spiral Framework Pieces Module

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dmitry Mironov
by Anton Titov
by Lev Seleznev

20/07 2017

v1.0.6

1.0.6.0

Spiral Framework Pieces Module

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dmitry Mironov
by Anton Titov
by Lev Seleznev

29/06 2017

v1.0.5

1.0.5.0

Spiral Framework Pieces Module

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dmitry Mironov
by Anton Titov
by Lev Seleznev

29/06 2017

v1.0.3

1.0.3.0

Spiral Framework Pieces Module

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dmitry Mironov
by Anton Titov
by Lev Seleznev

29/06 2017

v1.0.0

1.0.0.0

Spiral Framework Pieces Module

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dmitry Mironov
by Anton Titov
by Lev Seleznev

29/06 2017

v0.9.9

0.9.9.0

Spiral Framework Pieces Module

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dmitry Mironov
by Anton Titov
by Lev Seleznev

29/06 2017

v0.9.8

0.9.8.0

Spiral Framework Pieces Module

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dmitry Mironov
by Anton Titov
by Lev Seleznev

12/06 2017

v0.9.7

0.9.7.0

Spiral Framework Pieces Module

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dmitry Mironov
by Anton Titov
by Lev Seleznev

06/06 2017

v0.9.6

0.9.6.0

Spiral Framework Pieces Module

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dmitry Mironov
by Anton Titov
by Lev Seleznev

02/06 2017

v0.9.5

0.9.5.0

Spiral Framework Pieces Module

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dmitry Mironov
by Anton Titov
by Lev Seleznev

20/04 2017

v0.9.4

0.9.4.0

Spiral Framework Pieces Module

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dmitry Mironov
by Anton Titov
by Lev Seleznev

20/04 2017

v0.9.2

0.9.2.0

Spiral Framework Pieces Module

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dmitry Mironov
by Anton Titov
by Lev Seleznev

20/04 2017

v0.9.3

0.9.3.0

Spiral Framework Pieces Module

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dmitry Mironov
by Anton Titov
by Lev Seleznev

06/04 2017

v0.9.1

0.9.1.0

Spiral Framework Pieces Module

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dmitry Mironov
by Anton Titov
by Lev Seleznev

21/03 2017

v0.9.0

0.9.0.0

Spiral Framework Pieces Module

  Sources   Download

MIT

The Requires

 

The Development Requires

by Dmitry Mironov
by Anton Titov
by Lev Seleznev

10/03 2017

v0.8.3

0.8.3.0

Spiral Framework Pieces Module

  Sources   Download

MIT

The Requires

 

by Dmitry Mironov
by Anton Titov
by Lev Seleznev

10/03 2017

v0.8.2

0.8.2.0

Spiral Framework Pieces Module

  Sources   Download

MIT

The Requires

 

by Dmitry Mironov
by Anton Titov
by Lev Seleznev

09/03 2017

v0.8.1

0.8.1.0

Spiral Framework Pieces Module

  Sources   Download

MIT

The Requires

 

by Dmitry Mironov
by Anton Titov
by Lev Seleznev

06/03 2017

v0.8.0

0.8.0.0

Spiral Framework Pieces Module

  Sources   Download

MIT

The Requires

 

by Dmitry Mironov
by Anton Titov
by Lev Seleznev