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 use ICanBoogie\Core;
15
16 /**
17 * "Node" editor.
18 */
19 class NodeEditor implements Editor
20 {
21 /**
22 * Returns content as is.
23 *
24 * @see Icybee\Modules\Editor.Editor::serialize()
25 */
26 public function serialize($content)
27 {
28 return $content;
29 }
30
31 /**
32 * Returns serialized content as is.
33 *
34 * @see Icybee\Modules\Editor.Editor::unserialize()
35 */
36 public function unserialize($serialized_content)
37 {
38 return $serialized_content;
39 }
40 /**
41 * @return RawEditorElement
42 *
43 * @see Icybee\Modules\Editor.Editor::from()
44 */
45 public function from(array $attributes)
46 {
47 return new NodeEditorElement($attributes);
48 }
49
50 /**
51 * Returns content as is.
52 *
53 * @see Icybee\Modules\Editor.Editor::render()
54 */
55 public function render($content)
56 {
57 return $content ? Core::get()->models['nodes'][$content] : null;
58 }
59 }