ViewMaker
View Maker Trait
Adds view based methods to a class
trait System\Traits\ViewMaker
Properties
public $layout : string
Layout to use for the view.
public
$suppressLayout
:
bool
= false
Prevents the use of a layout.
public
$vars
:
array
= []
A list of variables to pass to the page.
protected $layoutPath : string
Specifies a path to the layout directory.
protected $viewPath : string | array
Specifies a path to the views directory.
Methods
public addViewPath (string | array $path) : void
Prepends a path on the available view path locations.
Property | Type | Description |
---|---|---|
$path | string | array |
string | array
|
public
getViewPath (string $fileName, $viewPaths = null
)
: string
Locates a file based on its definition. The file name can be prefixed with a symbol (~|$) to return in context of the application or plugin base path, otherwise it will be returned in context of this object view path.
If the fileName cannot be found it will be returned unmodified.
Property | Type | Description |
---|---|---|
$fileName | string |
string
|
$viewPaths | mixed |
mixed
|
public getViewPaths () : array
Returns the active view path locations.
public
guessViewPath (string $suffix = ""
, boolean $isPublic = false
)
: string | null
Guess the package path for the called class.
Property | Type | Description |
---|---|---|
$suffix | string |
string
An extra path to attach to the end |
$isPublic | boolean |
boolean
Returns public path instead of an absolute one |
public
guessViewPathFrom (string $class, string $suffix = ""
, boolean $isPublic = false
)
: string | null
Guess the package path from a specified class.
Property | Type | Description |
---|---|---|
$class | string |
string
Class to guess path from. |
$suffix | string |
string
An extra path to attach to the end |
$isPublic | boolean |
boolean
Returns public path instead of an absolute one |
public
makeFileContents (string $filePath, array $extraParams = []
)
: string
Includes a file path using output buffering, making the provided vars available.
Property | Type | Description |
---|---|---|
$filePath | string |
string
|
$extraParams | array |
array
|
public
makeLayout ($name = null
, array $params = []
, boolean $throwException = true
)
: string | bool
Render a layout, defaulting to the layout propery specified on the class
Property | Type | Description |
---|---|---|
$name | mixed |
mixed
|
$params | array |
array
|
$throwException | boolean |
boolean
|
The layout contents, or false.
public
makeLayoutPartial (string $partial, array $params = []
)
: string
Renders a layout partial
Property | Type | Description |
---|---|---|
$partial | string |
string
|
$params | array |
array
|
public
makePartial (string $partial, array $params = []
, boolean $throwException = true
)
: mixed
Render a partial file contents located in the views folder.
Property | Type | Description |
---|---|---|
$partial | string |
string
|
$params | array |
array
|
$throwException | boolean |
boolean
|
Partial contents or false if not throwing an exception.
public makeView (string $view) : string
Loads the specified view. Applies the layout if one is set.
The view file must have the .php extension (or ".htm" for historical reasons) and be located in the views directory
Property | Type | Description |
---|---|---|
$view | string |
string
|
public
makeViewContent (string $contents, $layout = null
)
: string
Renders supplied contents inside a layout.
Property | Type | Description |
---|---|---|
$contents | string |
string
|
$layout | mixed |
mixed
|
protected handleViewException (Throwable $e, integer $obLevel) : void
Handle a view exception.
Property | Type | Description |
---|---|---|
$e | Throwable |
Throwable
|
$obLevel | integer |
integer
|
Used by
Class | Description |
---|---|
EventLogs
|
Event Logs controller |
MailBrandSettings
|
Mail brand customization controller |
MailLayouts
|
Mail layouts controller |
MailPartials
|
Mail partials controller |
MailTemplates
|
Mail templates controller |
RequestLogs
|
Request Logs controller |
Settings
|
Settings controller |
Updates
|
Updates controller |
MailBrandSetting
|
Mail brand settings |
Status
|
System status report widget. |
FormController
|
Adds features for working with backend forms. This behavior will inject CRUD actions to the controller -- including create, update and preview -- along with some relevant AJAX handlers. |
ImportExportController
|
Adds features for importing and exporting data. |
ListController
|
Adds features for working with backend lists. |
RelationController
|
Uses a combination of lists and forms for managing Model relations. |
ReorderController
|
Used for reordering and sorting records. |
Controller
|
The Backend base controller class, used by Backend controllers. |
ControllerBehavior
|
Controller Behavior base class |
FormWidgetBase
|
Form Widget base class Widgets used specifically for forms |
ReportWidgetBase
|
Report Widget base class Report widgets are used inside the ReportContainer. |
WidgetBase
|
Widget base class. |
AccessLogs
|
Access Logs controller |
Auth
|
Authentication controller |
Files
|
Backend files controller |
Index
|
Dashboard controller |
Media
|
Backend Media Manager |
Preferences
|
Editor Settings controller |
UserGroups
|
Backend user groups controller |
UserRoles
|
Backend user groups controller |
Users
|
Backend user controller |
CodeEditor
|
Code Editor Renders a code editor field. |
ColorPicker
|
Color picker Renders a color picker field. |
DataTable
|
Data Table Renders a table field. |
DatePicker
|
Date picker Renders a date picker field. |
FileUpload
|
File upload field Renders a form file uploader field. |
IconPicker
|
Icon picker Renders an icon picker field. |
MarkdownEditor
|
Code Editor Renders a code editor field. |
MediaFinder
|
Media Finder Renders a record finder field. |
NestedForm
|
Nested Form Renders a nested form bound to a jsonable field of a model. |
PermissionEditor
|
User/group permission editor This widget is used by the system internally on the System / Administrators pages. |
RecordFinder
|
Record Finder Renders a record finder field. |
Relation
|
Form Relationship Renders a field prepopulated with a belongsTo and belongsToHasMany relation. |
RelationManager
|
|
Repeater
|
Repeater Form Widget |
RichEditor
|
Rich Editor Renders a rich content editor field. |
Sensitive
|
Sensitive widget. |
TagList
|
Tag List Form Widget |
BrandSetting
|
Brand settings that affect all users |
EditorSetting
|
Editor settings that affect all users |
Welcome
|
User welcome report widget. |
Filter
|
Filter Widget Renders a container used for filtering things. |
Form
|
Form Widget Used for building back end forms and renders a form. |
Lists
|
List Widget Used for building back end lists, renders a list of model objects |
MediaManager
|
Media Manager widget. |
ReportContainer
|
Report Container Widget Creates an area hosting report widgets. |
Search
|
Search Widget Used for building a toolbar, Renders a search container. |
Table
|
Table Widget. |
Toolbar
|
Toolbar Widget Used for building a toolbar, renders a toolbar. |
Index
|
CMS index |
Media
|
CMS Media Manager |
ThemeLogs
|
Request Logs controller |
ThemeOptions
|
Theme customization controller |
Themes
|
Theme selector controller |
Components
|
Component Builder Builds a collection of Cms components and configures them. |
MediaFinder
|
Media Finder Renders a record finder field. |
ActiveTheme
|
Active theme report widget. |
AssetList
|
CMS asset list widget. |
ComponentList
|
Component list widget. |
MediaManager
|
Media Manager widget. |
TemplateList
|
Template list widget. |