Autodoc
  • Namespace
  • Class
  • Tree

Namespaces

  • BlueTihi
    • Context
  • Brickrouge
    • Element
      • Nodes
    • Renderer
    • Widget
  • ICanBoogie
    • ActiveRecord
    • AutoConfig
    • CLDR
    • Composer
    • Core
    • Event
    • Exception
    • HTTP
      • Dispatcher
      • Request
    • I18n
      • Translator
    • Mailer
    • Modules
      • Taxonomy
        • Support
      • Thumbnailer
        • Versions
    • Object
    • Operation
      • Dispatcher
    • Prototype
    • Routes
    • Routing
      • Dispatcher
    • Session
  • Icybee
    • ActiveRecord
      • Model
    • ConfigOperation
    • Document
    • EditBlock
    • Element
      • ActionbarContextual
      • ActionbarSearch
      • ActionbarToolbar
    • FormBlock
    • Installer
    • ManageBlock
    • Modules
      • Articles
      • Cache
        • Collection
        • ManageBlock
      • Comments
        • ManageBlock
      • Contents
        • ManageBlock
      • Dashboard
      • Editor
        • Collection
      • Files
        • File
        • ManageBlock
      • Forms
        • Form
        • ManageBlock
      • I18n
      • Images
        • ManageBlock
      • Members
      • Modules
        • ManageBlock
      • Nodes
        • ManageBlock
        • Module
      • Pages
        • BreadcrumbElement
        • LanguagesElement
        • ManageBlock
        • NavigationBranchElement
        • NavigationElement
        • Page
        • PageController
      • Registry
      • Search
      • Seo
      • Sites
        • ManageBlock
      • Taxonomy
        • Terms
          • ManageBlock
        • Vocabulary
          • ManageBlock
      • Users
        • ManageBlock
        • NonceLogin
        • Roles
      • Views
        • ActiveRecordProvider
        • Collection
        • View
    • Operation
      • ActiveRecord
      • Constructor
      • Module
      • Widget
    • Rendering
  • None
  • Patron
  • PHP

Classes

  • ActiveRecordProvider
  • CacheManager
  • Collection
  • Hooks
  • Module
  • Provider
  • TemplateResolver
  • View
  • ViewEditor
  • ViewEditorElement
  • ViewOptions
 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\Views;
13 
14 use ICanBoogie\Exception;
15 
16 use Brickrouge\Element;
17 
18 /**
19  * View editor.
20  */
21 class ViewEditor implements \Icybee\Modules\Editor\Editor
22 {
23     /**
24      * Returns the content as is.
25      *
26      * @see Icybee\Modules\Editor.Editor::serialize()
27      */
28     public function serialize($content)
29     {
30         return $content;
31     }
32 
33     /**
34      * Returns the serialized content as is.
35      *
36      * @see Icybee\Modules\Editor.Editor::unserialize()
37      */
38     public function unserialize($serialized_content)
39     {
40         return $serialized_content;
41     }
42 
43     /**
44      * @return ViewEditorElement
45      *
46      * @see Icybee\Modules\Editor.Editor::from()
47      */
48     public function from(array $attributes)
49     {
50         return new ViewEditorElement($attributes);
51     }
52 
53     public function render($id, $engine=null, $template=null) // TODO-20120811: this is pretty bad, we should use the request context or something
54     {
55         global $core;
56 
57         $patron = \Patron\Engine::get_singleton();
58         $page = isset($core->request->context->page) ? $core->request->context->page : null;
59 
60         if (!$page)
61         {
62             $page = $core->site->resolve_view_target($id);
63 
64             if (!$page)
65             {
66                 $page = $core->site->home;
67             }
68         }
69 
70         $definition = $core->views[$id];
71         $class = $definition['class'] ?: 'Icybee\Modules\Views\View';
72         $view = new $class($id, $definition, $patron, $core->document, $page);
73         $rc = $view();
74 
75         if ($template)
76         {
77             return $engine($template, $rc);
78         }
79 
80         return $rc;
81     }
82 }
Autodoc API documentation generated by ApiGen 2.8.0