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\Forms;
13
14 use ICanBoogie\Core;
15
16 /**
17 * "Form" editor.
18 */
19 class FormEditor implements \Icybee\Modules\Editor\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 FormEditorElement
42 *
43 * @see Icybee\Modules\Editor.Editor::from()
44 */
45 public function from(array $attributes)
46 {
47 return new FormEditorElement($attributes);
48 }
49
50 /**
51 * Returns a _Form_ active record.
52 *
53 * @return Icybee\Modules\Forms\Form
54 *
55 * @see Icybee\Modules\Editor.Editor::render()
56 */
57 public function render($content)
58 {
59 return $content ? Core::get()->models['forms'][$content] : null;
60 }
61 }