1 <?php
2
3 /*
4 * This file is part of the Icybee package.
5 *
6 * (c) Olivier Laviale <olivier.laviale@gmail.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 namespace Icybee\Modules\Editor;
13
14 /**
15 * The editor interface is used to serialize/unserialize the content edited by the editor it
16 * provides, as well as render this content.
17 */
18 interface Editor
19 {
20 /**
21 * Serialize the content.
22 *
23 * @param mixed $content
24 */
25 public function serialize($content);
26
27 /**
28 * Unserialize the serialized content.
29 *
30 * @param string $serialized_content
31 */
32 public function unserialize($serialized_content);
33
34 /**
35 * Creates the editor element from the provided attributes.
36 *
37 * The content of the editor is provided using the `value` attribute.
38 *
39 * @param array $attributes Attributes that should be used to create the element. The content
40 * of the element must be provided using the `value` attribute, and must be unserialized.
41 *
42 * @return \Brickrouge\Element
43 */
44 public function from(array $attributes);
45
46 /**
47 * Renders the content into a HTML string or an object that can be stringified into a HTML
48 * string.
49 *
50 * @param string $content
51 */
52 public function render($content);
53 }
54
55 /**
56 * Interface for editor elements.
57 */
58 interface EditorElement
59 {
60 const STYLESHEETS = '#editor-stylesheet';
61 const CONFIG = '#editor-config';
62 }