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

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.

Parameters
Property Description
$path
string | array
Returns
void

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.

Parameters
Property Description
$fileName
string
$viewPaths
mixed
Returns
string

public getViewPaths () : array

Returns the active view path locations.

Returns
array

public guessViewPath (string $suffix = "", boolean $isPublic = false) : string | null

Guess the package path for the called class.

Parameters
Property Description
$suffix
string

An extra path to attach to the end

$isPublic
boolean

Returns public path instead of an absolute one

Returns
string | null

public guessViewPathFrom (string $class, string $suffix = "", boolean $isPublic = false) : string | null

Guess the package path from a specified class.

Parameters
Property Description
$class
string

Class to guess path from.

$suffix
string

An extra path to attach to the end

$isPublic
boolean

Returns public path instead of an absolute one

Returns
string | null

public makeFileContents (string $filePath, array $extraParams = []) : string

Includes a file path using output buffering, making the provided vars available.

Parameters
Property Description
$filePath
string
$extraParams
array
Returns
string

public makeLayout ($name = null, array $params = [], boolean $throwException = true) : string | bool

Render a layout, defaulting to the layout propery specified on the class

Parameters
Property Description
$name
mixed
$params
array
$throwException
boolean
Returns
string | bool

The layout contents, or false.

public makeLayoutPartial (string $partial, array $params = []) : string

Renders a layout partial

Parameters
Property Description
$partial
string
$params
array
Returns
string

public makePartial (string $partial, array $params = [], boolean $throwException = true) : mixed

Render a partial file contents located in the views folder.

Parameters
Property Description
$partial
string
$params
array
$throwException
boolean
Returns
mixed

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

Parameters
Property Description
$view
string
Returns
string

public makeViewContent (string $contents, $layout = null) : string

Renders supplied contents inside a layout.

Parameters
Property Description
$contents
string
$layout
mixed
Returns
string

protected handleViewException (Throwable $e, integer $obLevel) : void

Handle a view exception.

Parameters
Property Description
$e
Throwable
$obLevel
integer
Returns
void

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.

Copyright © 2024 Winter CMS