EditorSetting
extends Model
in package
Uses
ViewMaker, Validation
Backend\Models\EditorSetting
Tags
Table of Contents
- $cacheKey : string
- $id : int
- $implement : array<string|int, mixed>
- $item : string|null
- $layout : string
- $rules : mixed
- Validation rules
- $settingsCode : string
- $settingsFields : mixed
- $suppressLayout : bool
- $value : string|null
- $vars : array<string|int, mixed>
- $defaultHtmlAllowEmptyTags : mixed
- $defaultHtmlAllowTags : mixed
- $defaultHtmlLineBreakerTags : mixed
- $defaultHtmlNoWrapTags : mixed
- $defaultHtmlParagraphFormats : mixed
- $defaultHtmlRemoveTags : mixed
- $defaultHtmlStyleImage : mixed
- $defaultHtmlStyleLink : mixed
- $defaultHtmlStyleParagraph : mixed
- $defaultHtmlStyleTable : mixed
- $defaultHtmlStyleTableCell : mixed
- $editorToolbarPresets : mixed
- Editor toolbar presets for Froala.
- $layoutPath : string
- $validationDefaultAttrNames : array<string|int, mixed>
- $validationErrors : MessageBag
- $viewPath : string|array<string|int, mixed>
- addViewPath() : void
- Prepends a path on the available view path locations.
- afterFetch() : mixed
- afterSave() : mixed
- all() :
- bootValidation() : void
- Boot the validation trait for this model.
- compileCss() : mixed
- errors() : MessageBag
- Get validation error message collection for the Model
- forceSave() : bool
- Force save the model even if validation fails.
- get() :
- getConfigured() : mixed
- Returns the value only if it differs from the default value.
- getConfiguredFormats() : mixed
- Same as getConfigured but uses a special structure for paragraph formats.
- getConfiguredStyles() : mixed
- Same as getConfigured but uses a special structure for styles.
- getDefaultValue() : mixed
- getEditorToolbarPresets() : array<string|int, mixed>
- Return the editor toolbar presets without line breaks.
- getViewPath() : 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.
- getViewPaths() : array<string|int, mixed>
- Returns the active view path locations.
- guessViewPath() : string
- Guess the package path for the called class.
- guessViewPathFrom() : string
- Guess the package path from a specified class.
- initSettingsData() : void
- Initialize the seed data for this model. This only executes when the model is first created or reset to default.
- isAttributeRequired() : bool
- Determines if an attribute is required based on the validation rules.
- makeFileContents() : string
- Includes a file path using output buffering.
- makeLayout() : mixed
- Render a layout.
- makeLayoutPartial() : string
- Renders a layout partial
- makePartial() : mixed
- Render a partial file contents located in the views folder.
- makeView() : string
- Loads a view with the name specified. Applies layout if its name is provided by the parent object.
- makeViewContent() : string
- Renders supplied contents inside a layout.
- newModelQuery() :
- newQuery() :
- query() :
- renderCss() : mixed
- setValidationAttributeName() : void
- Programatically sets the validation attribute names, will take lower priority to model defined attribute names found in `$attributeNames`.
- setValidationAttributeNames() : void
- Programatically sets multiple validation attribute names.
- validate() : bool
- Validate the model instance
- validated() : void
- Create a new native event for handling afterValidate().
- validating() : void
- Create a new native event for handling beforeValidate().
- whereId() :
- whereItem() :
- whereValue() :
- getConfiguredArray() : mixed
- getRelationValidationValue() : mixed
- Attachments validate differently to their simple values.
- getValidationAttributes() : array<string|int, mixed>
- Returns the model data used for validation.
- handleViewException() : void
- Handle a view exception.
- makeFormatsForTable() : mixed
- makeStylesForTable() : mixed
- makeValidator() : Validator
- Instantiates the validator used by the validation process, depending if the class is being used inside or outside of Laravel. Optional connection string to make the validator use a different database connection than the default connection.
- processRuleFieldNames() : array<string|int, mixed>
- Processes field names in a rule array.
- processValidationRules() : mixed
- Process rules
- processValidationUniqueRule() : string
- Rebuilds the unique validation rule to force for the existing ID
Properties
$cacheKey
public
string
$cacheKey
= 'backend::editor.custom_css'
The key to store rendered CSS in the cache under
$id
public
int
$id
$implement
public
array<string|int, mixed>
$implement
= [SystemBehaviorsSettingsModel::class]
Behaviors implemented by this model.
$item
public
string|null
$item
$layout
public
string
$layout
Layout to use for the view.
$rules
Validation rules
public
mixed
$rules
= []
$settingsCode
public
string
$settingsCode
= 'backend_editor_settings'
Unique code
$settingsFields
public
mixed
$settingsFields
= 'fields.yaml'
Settings form field defitions
$suppressLayout
public
bool
$suppressLayout
= false
Prevents the use of a layout.
$value
public
string|null
$value
$vars
public
array<string|int, mixed>
$vars
= []
A list of variables to pass to the page.
$defaultHtmlAllowEmptyTags
protected
mixed
$defaultHtmlAllowEmptyTags
= 'textarea, a, iframe, object, video, style, script, .fa, .fr-emoticon, .fr-inner, path, line, hr, i'
$defaultHtmlAllowTags
protected
mixed
$defaultHtmlAllowTags
= 'a, abbr, address, area, article, aside, audio, b, bdi, bdo, blockquote, br, button, canvas, caption, cite, code, col, colgroup, datalist, dd, del, details, dfn, dialog, div, dl, dt, em, embed, fieldset, figcaption, figure, footer, form, h1, h2, h3, h4, h5, h6, header, hgroup, hr, i, iframe, img, input, ins, kbd, keygen, label, legend, li, link, main, map, mark, menu, menuitem, meter, nav, noscript, object, ol, optgroup, option, output, p, param, pre, progress, queue, rp, rt, ruby, s, samp, script, style, section, select, small, source, span, strike, strong, sub, summary, sup, table, tbody, td, textarea, tfoot, th, thead, time, title, tr, track, u, ul, var, video, wbr'
$defaultHtmlLineBreakerTags
protected
mixed
$defaultHtmlLineBreakerTags
= 'figure, table, hr, iframe, form, dl'
$defaultHtmlNoWrapTags
protected
mixed
$defaultHtmlNoWrapTags
= 'figure, script, style'
$defaultHtmlParagraphFormats
protected
mixed
$defaultHtmlParagraphFormats
= ['N' => 'Normal', 'H1' => 'Heading 1', 'H2' => 'Heading 2', 'H3' => 'Heading 3', 'H4' => 'Heading 4', 'PRE' => 'Code']
$defaultHtmlRemoveTags
protected
mixed
$defaultHtmlRemoveTags
= 'script, style, base'
$defaultHtmlStyleImage
protected
mixed
$defaultHtmlStyleImage
= ['oc-img-rounded' => 'Rounded', 'oc-img-bordered' => 'Bordered']
$defaultHtmlStyleLink
protected
mixed
$defaultHtmlStyleLink
= ['oc-link-green' => 'Green', 'oc-link-strong' => 'Strong']
$defaultHtmlStyleParagraph
protected
mixed
$defaultHtmlStyleParagraph
= ['oc-text-bordered' => 'Bordered', 'oc-text-gray' => 'Gray', 'oc-text-spaced' => 'Spaced', 'oc-text-uppercase' => 'Uppercase']
$defaultHtmlStyleTable
protected
mixed
$defaultHtmlStyleTable
= ['oc-dashed-borders' => 'Dashed Borders', 'oc-alternate-rows' => 'Alternate Rows']
$defaultHtmlStyleTableCell
protected
mixed
$defaultHtmlStyleTableCell
= ['oc-cell-highlighted' => 'Highlighted', 'oc-cell-thick-border' => 'Thick Border']
$editorToolbarPresets
Editor toolbar presets for Froala.
protected
mixed
$editorToolbarPresets
= ['default' => 'paragraphFormat, paragraphStyle, quote, bold, italic, align, formatOL, formatUL, insertTable,
insertLink, insertImage, insertVideo, insertAudio, insertFile, insertHR, html', 'minimal' => 'paragraphFormat, bold, italic, underline, |, insertLink, insertImage, |, html', 'full' => 'undo, redo, |, bold, italic, underline, |, paragraphFormat, paragraphStyle, inlineStyle, |,
strikeThrough, subscript, superscript, clearFormatting, |, fontFamily, fontSize, |, color,
emoticons, -, selectAll, |, align, formatOL, formatUL, outdent, indent, quote, |, insertHR,
insertLink, insertImage, insertVideo, insertAudio, insertFile, insertTable, |, selectAll,
html, fullscreen']
$layoutPath
protected
string
$layoutPath
Specifies a path to the layout directory.
$validationDefaultAttrNames
protected
array<string|int, mixed>
$validationDefaultAttrNames
= []
Default custom attribute names.
$validationErrors
protected
MessageBag
$validationErrors
The message bag instance containing validation error messages
$viewPath
protected
string|array<string|int, mixed>
$viewPath
Specifies a path to the views directory.
Methods
addViewPath()
Prepends a path on the available view path locations.
public
addViewPath(string|array<string|int, mixed> $path) : void
Parameters
- $path : string|array<string|int, mixed>
Return values
void —afterFetch()
public
afterFetch() : mixed
Return values
mixed —afterSave()
public
afterSave() : mixed
Return values
mixed —all()
public
static all(mixed $columns) :
Parameters
- $columns : mixed
Return values
—bootValidation()
Boot the validation trait for this model.
public
static bootValidation() : void
Return values
void —compileCss()
public
static compileCss() : mixed
Return values
mixed —errors()
Get validation error message collection for the Model
public
errors() : MessageBag
Return values
MessageBag —forceSave()
Force save the model even if validation fails.
public
forceSave([mixed $options = null ][, mixed $sessionKey = null ]) : bool
Parameters
- $options : mixed = null
- $sessionKey : mixed = null
Return values
bool —get()
public
static get(mixed $columns) :
Parameters
- $columns : mixed
Return values
—getConfigured()
Returns the value only if it differs from the default value.
public
static getConfigured(mixed $key[, mixed $default = null ]) : mixed
Parameters
- $key : mixed
- $default : mixed = null
Return values
mixed —getConfiguredFormats()
Same as getConfigured but uses a special structure for paragraph formats.
public
static getConfiguredFormats(mixed $key[, mixed $default = null ]) : mixed
Parameters
- $key : mixed
- $default : mixed = null
Return values
mixed —getConfiguredStyles()
Same as getConfigured but uses a special structure for styles.
public
static getConfiguredStyles(mixed $key[, mixed $default = null ]) : mixed
Parameters
- $key : mixed
- $default : mixed = null
Return values
mixed —getDefaultValue()
public
getDefaultValue(mixed $attribute) : mixed
Parameters
- $attribute : mixed
Return values
mixed —getEditorToolbarPresets()
Return the editor toolbar presets without line breaks.
public
getEditorToolbarPresets() : array<string|int, mixed>
Return values
array<string|int, mixed> —getViewPath()
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.
public
getViewPath(string $fileName[, mixed $viewPath = null ]) : string
Parameters
- $fileName : string
-
File to load.
- $viewPath : mixed = null
-
Explicitly define a view path.
Return values
string —Full path to the view file.
getViewPaths()
Returns the active view path locations.
public
getViewPaths() : array<string|int, mixed>
Return values
array<string|int, mixed> —guessViewPath()
Guess the package path for the called class.
public
guessViewPath([string $suffix = '' ][, bool $isPublic = false ]) : string
Parameters
- $suffix : string = ''
-
An extra path to attach to the end
- $isPublic : bool = false
-
Returns public path instead of an absolute one
Return values
string —guessViewPathFrom()
Guess the package path from a specified class.
public
guessViewPathFrom(string $class[, string $suffix = '' ][, bool $isPublic = false ]) : string
Parameters
- $class : string
-
Class to guess path from.
- $suffix : string = ''
-
An extra path to attach to the end
- $isPublic : bool = false
-
Returns public path instead of an absolute one
Return values
string —initSettingsData()
Initialize the seed data for this model. This only executes when the model is first created or reset to default.
public
initSettingsData() : void
Return values
void —isAttributeRequired()
Determines if an attribute is required based on the validation rules.
public
isAttributeRequired(string $attribute[, bool $checkDependencies = true ]) : bool
Parameters
- $attribute : string
- $checkDependencies : bool = true
-
Checks the attribute dependencies (for required_if & required_with rules). Note that it will only be checked up to the next level, if another dependent rule is found then it will just assume the field is required
Return values
bool —makeFileContents()
Includes a file path using output buffering.
public
makeFileContents(string $filePath[, array<string|int, mixed> $extraParams = [] ]) : string
Ensures that vars are available.
Parameters
- $filePath : string
-
Absolute path to the view file.
- $extraParams : array<string|int, mixed> = []
-
Parameters that should be available to the view.
Return values
string —makeLayout()
Render a layout.
public
makeLayout([string $name = null ][, array<string|int, mixed> $params = [] ][, bool $throwException = true ]) : mixed
Parameters
- $name : string = null
-
Specifies the layout name. If this parameter is omitted, the $layout property will be used.
- $params : array<string|int, mixed> = []
-
Parameter variables to pass to the view.
- $throwException : bool = true
-
Throw an exception if the layout is not found
Return values
mixed —The layout contents, or false.
makeLayoutPartial()
Renders a layout partial
public
makeLayoutPartial(string $partial[, array<string|int, mixed> $params = [] ]) : string
Parameters
- $partial : string
-
The view to load.
- $params : array<string|int, mixed> = []
-
Parameter variables to pass to the view.
Return values
string —The layout partial contents
makePartial()
Render a partial file contents located in the views folder.
public
makePartial(string $partial[, array<string|int, mixed> $params = [] ][, bool $throwException = true ]) : mixed
Parameters
- $partial : string
-
The view to load.
- $params : array<string|int, mixed> = []
-
Parameter variables to pass to the view.
- $throwException : bool = true
-
Throw an exception if the partial is not found.
Return values
mixed —Partial contents or false if not throwing an exception.
makeView()
Loads a view with the name specified. Applies layout if its name is provided by the parent object.
public
makeView(string $view) : string
The view file must be situated in the views directory, and has the extension "htm".
Parameters
- $view : string
-
Specifies the view name, without extension. Eg: "index".
Return values
string —makeViewContent()
Renders supplied contents inside a layout.
public
makeViewContent(string $contents[, string $layout = null ]) : string
Parameters
- $contents : string
-
The inner contents as a string.
- $layout : string = null
-
Specifies the layout name.
Return values
string —newModelQuery()
public
static newModelQuery() :
Return values
—newQuery()
public
static newQuery() :
Return values
—query()
public
static query() :
Return values
—renderCss()
public
static renderCss() : mixed
Return values
mixed —setValidationAttributeName()
Programatically sets the validation attribute names, will take lower priority to model defined attribute names found in `$attributeNames`.
public
setValidationAttributeName(string $attr, string $name) : void
Parameters
- $attr : string
- $name : string
Return values
void —setValidationAttributeNames()
Programatically sets multiple validation attribute names.
public
setValidationAttributeNames(array<string|int, mixed> $attributeNames) : void
Parameters
- $attributeNames : array<string|int, mixed>
Return values
void —validate()
Validate the model instance
public
validate([mixed $rules = null ][, mixed $customMessages = null ][, mixed $attributeNames = null ]) : bool
Parameters
- $rules : mixed = null
- $customMessages : mixed = null
- $attributeNames : mixed = null
Return values
bool —validated()
Create a new native event for handling afterValidate().
public
static validated(Closure|string $callback) : void
Parameters
- $callback : Closure|string
Return values
void —validating()
Create a new native event for handling beforeValidate().
public
static validating(Closure|string $callback) : void
Parameters
- $callback : Closure|string
Return values
void —whereId()
public
static whereId(mixed $value) :
Parameters
- $value : mixed
Return values
—whereItem()
public
static whereItem(mixed $value) :
Parameters
- $value : mixed
Return values
—whereValue()
public
static whereValue(mixed $value) :
Parameters
- $value : mixed
Return values
—getConfiguredArray()
protected
static getConfiguredArray(mixed $key[, mixed $default = null ][, mixed $callback = null ]) : mixed
Parameters
- $key : mixed
- $default : mixed = null
- $callback : mixed = null
Return values
mixed —getRelationValidationValue()
Attachments validate differently to their simple values.
protected
getRelationValidationValue(mixed $relationName) : mixed
Parameters
- $relationName : mixed
Return values
mixed —getValidationAttributes()
Returns the model data used for validation.
protected
getValidationAttributes() : array<string|int, mixed>
Return values
array<string|int, mixed> —handleViewException()
Handle a view exception.
protected
handleViewException(Exception $e, int $obLevel) : void
Parameters
- $e : Exception
- $obLevel : int
Return values
void —makeFormatsForTable()
protected
makeFormatsForTable(mixed $arr) : mixed
Parameters
- $arr : mixed
Return values
mixed —makeStylesForTable()
protected
makeStylesForTable(mixed $arr) : mixed
Parameters
- $arr : mixed
Return values
mixed —makeValidator()
Instantiates the validator used by the validation process, depending if the class is being used inside or outside of Laravel. Optional connection string to make the validator use a different database connection than the default connection.
protected
static makeValidator(mixed $data, mixed $rules, mixed $customMessages, mixed $attributeNames[, mixed $connection = null ]) : Validator
Parameters
- $data : mixed
- $rules : mixed
- $customMessages : mixed
- $attributeNames : mixed
- $connection : mixed = null
Return values
Validator —processRuleFieldNames()
Processes field names in a rule array.
protected
processRuleFieldNames(array<string|int, mixed> $rules) : array<string|int, mixed>
Converts any field names using array notation (ie. field[child]) into dot notation (ie. field.child)
Parameters
- $rules : array<string|int, mixed>
-
Rules array
Return values
array<string|int, mixed> —processValidationRules()
Process rules
protected
processValidationRules(mixed $rules) : mixed
Parameters
- $rules : mixed
Return values
mixed —processValidationUniqueRule()
Rebuilds the unique validation rule to force for the existing ID
protected
processValidationUniqueRule(string $definition, string $fieldName) : string
Parameters
- $definition : string
- $fieldName : string