\NLView
NLView represents an area on a page or a view which is to provide a component based presentation. It is capable of rendering itself in a template. All you need to give it is the serialised component hierarchy and the context for binding.
Synopsis
class NLView
extends Controller
{
- // members
- private static $layout_manager_class = NULL;
- protected $layout = NULL;
- protected $rawComponents;
- protected $context;
- protected $layoutManager;
- public static string $default_view_contents = '{ "ClassName": "NLLayoutContainer", "children": [ ], "bindings": { } }';
- public static string $default_view_contents_alt = '{ "ClassName": "NLLayoutContainer", "children": [ { "ClassName": "NLTextComponent", "bindings": { "Text": { "type": "embedded", "value": "This is some <em>HTML</em> text (embedded)." } } }, { "ClassName": "NLLinkComponent", "bindings": { "ExternalURL": { "type": "embedded", "value": "http://disney.com" } }, "children": [ { "ClassName": "NLTextComponent", "bindings": { "Text": { "type": "embedded", "value": "an external link using embedded binding" } } } ] }, { "ClassName": "NLTextComponent", "bindings": { "Text": { "type": "context", "value": "GetFoo" } } } ], "bindings": { } }';
- public static string $default_view_contents_alt2 = '{ "ClassName": "NLLayoutContainer", "children": [ { "ClassName": "NLVerticalBoxLayout", "children": [ { "ClassName": "NLHorizontalBoxLayout", "children": [ { "ClassName": "NLLinkComponent", "bindings": { "ExternalURL": { "type": "embedded", "value": "http://disney.com" } }, "layout": { "classes": [ "col-md-4" ] }, "children": [ { "ClassName": "NLImageComponent", "bindings": { "InternalImage": { "type": "embedded", "value": "Image:1" }, "ResizingOption": { "type": "embedded", "value": "Resized" }, "Width": { "type": "embedded", "value": "60" }, "Height": { "type": "embedded", "value": "40" } } } ] }, { "ClassName": "NLTextComponent", "bindings": { "Text": { "type": "embedded", "value": "This is some embedded text that should appear to the right of the image." } }, "layout": { "classes": [ "col-md-8" ] } } ] }, { "ClassName": "NLTextComponent", "bindings": { "Text": { "type": "embedded", "value": "Here is some text that should be displayed below the image and other text" } } } ], "bindings": { } } ], "bindings": { } }';
- public static string $default_view_contents_old = '{ "ClassName": "NLVerticalBoxLayout", "children": [ { "ClassName": "NLTextComponent", "bindings": { "Text": { "type": "embedded", "value": "this is some text that is encoded for json and can contain HTML" } } }, { "ClassName": "NLLinkComponent", "bindings": { "ExternalURL": { "type": "embedded", "value": "http://disney.com" } }, "children": [ { "ClassName": "NLTextComponent", "bindings": { "Text": { "type": "embedded", "value": "my favourite website (external)" } } } ] }, { "ClassName": "NLLinkComponent", "bindings": { "InternalPage": { "type": "embedded", "value": "SiteTree:2" } }, "children": [ { "ClassName": "NLTextComponent", "bindings": { "Text": { "type": "embedded", "value": "my favourite website (internal)" } } } ] }, { "ClassName": "NLCanvasLayout", "children":[ { "ClassName": "NLTextComponent", "bindings": { "Text": { "type": "embedded", "value": "canvas child 1" } }, "layout": { "top":"10px", "height":"15px", "width":"20px" } }, { "ClassName": "NLTextComponent", "bindings": { "Text": { "type": "embedded", "value": "canvas child 2" } } } ], "layout": { "height":"75px", "width":"150px" } } ], "bindings": { } }';
- // methods
- public static void normalise_serialised()
- public void __construct()
- public void getLayout()
- public void getLayoutManager()
- public forTemplate()
- protected void getComponentItems()
- protected void findComponentById()
- protected void findComponentByIdParented()
Hierarchy
Extends
- Controller
Tasks
Line | Task |
---|---|
324 | do this programmatically |
328 | let context filter component types |
Members
private
- $layout_manager_class
protected
- $context
- $layout
- $layoutManager
- $rawComponents
public
- $default_view_contents
- $default_view_contents_alt
- $default_view_contents_alt2
- $default_view_contents_old
Methods
protected
public
- __construct() — Construct an NLView.
- forTemplate() — Render this view.
- getLayout() — Return the top-level layout component for this view.
- getLayoutManager()
- normalise_serialised()