Editor
Table of Contents
Constants
- BLOCK_COUNT_PER_PAGE = 14
- BLOCK_PHP_ATTR = 'data-bx-editor-php-slice'
- BLOCK_PLACE_ATTR = 'data-bx-block-editor-place'
- BLOCK_PLACE_ATTR_DEF_VALUE = 'body'
- SLICE_SECTION_ID = 'BX_BLOCK_EDITOR_EDITABLE_SECTION'
- STYLIST_TAG_ATTR = 'data-bx-stylist-container'
Properties
- $blocks : mixed
- $componentsAsBlocks : mixed
- $id : mixed
- $previewModes : mixed
- $tabs : mixed
- $tools : mixed
- $uiPatterns : mixed
Methods
- __construct() : mixed
- Create editor object.
- createInstance() : Editor
- Return editor object
- fillDocumentBySliceContent() : bool
- Fill template(as a DOM Document) by content.
- fillTemplateBySliceContent() : string
- Fill template(as a HTML) by slice content.
- getDefaultBlockList() : array<string|int, mixed>
- Return list of default blocks
- getDefaultToolList() : array<string|int, mixed>
- Return list of default tools, uses for block changing
- getHtmlForEditor() : string
- Return received string, that php changed in special format for block editor.
- getUI() : string
- Return html of interface part.
- isAvailableRussian() : bool
- Return true if can use Russian services.
- isContentSupported() : bool
- Check string for the presence of tag attributes that indicates supporting of block editor
- isHtmlDocument() : bool
- Check string for the presence of html
- replaceCharset() : string
- Replace charset in HTML string.
- setBlockList() : void
- Set custom blocks
- setComponentFilter() : void
- Set components filter
- setToolList() : void
- Set custom tools
- show() : string
- Return html for showing editor and include all resources
- showEditor() : string
- Return html of editor interface without resources.
Constants
BLOCK_COUNT_PER_PAGE
public
mixed
BLOCK_COUNT_PER_PAGE
= 14
BLOCK_PHP_ATTR
public
mixed
BLOCK_PHP_ATTR
= 'data-bx-editor-php-slice'
BLOCK_PLACE_ATTR
public
mixed
BLOCK_PLACE_ATTR
= 'data-bx-block-editor-place'
BLOCK_PLACE_ATTR_DEF_VALUE
public
mixed
BLOCK_PLACE_ATTR_DEF_VALUE
= 'body'
SLICE_SECTION_ID
public
mixed
SLICE_SECTION_ID
= 'BX_BLOCK_EDITOR_EDITABLE_SECTION'
STYLIST_TAG_ATTR
public
mixed
STYLIST_TAG_ATTR
= 'data-bx-stylist-container'
Properties
$blocks
public
mixed
$blocks
= array()
$componentsAsBlocks
public
mixed
$componentsAsBlocks
= array()
$id
public
mixed
$id
$previewModes
public
mixed
$previewModes
= array()
$tabs
public
mixed
$tabs
= array()
$tools
public
mixed
$tools
= array()
$uiPatterns
public
mixed
$uiPatterns
= array('main' => <<<HTML
\t\t#TEXTAREA#
\t\t<div id="bx-block-editor-container-#id#" class="bx-block-editor-container">
\t\t\t<div class="button-panel">
\t\t\t\t#tabs#
\t\t\t\t<span class="bx-editor-block-btn-close" title="#MESS_BTN_MIN#">#MESS_BTN_MIN#</span>
\t\t\t\t<span class="bx-editor-block-btn-full" title="#MESS_BTN_MAX#">#MESS_BTN_MAX#</span>
\t\t\t\t<span data-role="block-editor-tab-btn-get-html" class="bx-editor-block-btn-full bx-editor-block-btn-html-copy" title="#MESS_BTN_HTML_COPY#"></span>
\t\t\t</div>
\t\t\t#panels#
\t\t</div>
HTML, 'block' => <<<HTML
\t\t<li data-bx-block-editor-block-status="blank"
\t\t\tdata-bx-block-editor-block-type="#code#"
\t\t\tclass="bx-editor-typecode-#code_class# bx-editor-type-#type_class# bx-block-editor-i-block-list-item"
\t\t\ttitle="#desc#"
\t\t\t>
\t\t\t<span class="bx-block-editor-i-block-list-item-icon"></span>
\t\t\t<span class="bx-block-editor-i-block-list-item-name">#name#</span>
\t\t</li>
HTML, 'block_page' => <<<HTML
\t\t<ul class="bx-block-editor-i-block-list">
\t\t\t#blocks#
\t\t</ul>
HTML, 'tool' => <<<HTML
\t\t<div class="bx-editor-block-tools" data-bx-editor-tool="#group#:#id#">
\t\t\t<div class="caption">#name#:</div>
\t\t\t<div class="item">#html#</div>
\t\t</div>
HTML, 'device' => <<<HTML
\t\t<div class="device #class#" data-bx-preview-device-class="#class#" data-bx-preview-device-width="#width#" data-bx-preview-device-height="#height#">
\t\t\t<span>#MESS_NAME#</span>
\t\t</div>
HTML, 'tab' => <<<HTML
\t\t\t<span class="bx-editor-block-btn bx-editor-block-btn-#code# #tab_active#">#name#</span>
HTML, 'tab_active' => 'bx-editor-block-btn-active', 'panel' => <<<HTML
\t\t\t<div class="bx-editor-block-panel #code#-panel" #panel_hidden#>#html#</div>
HTML, 'panel_hidden' => 'style="display: none;"', 'panel-edit' => <<<HTML
\t\t\t<div class="visual-part">
\t\t\t\t<div class="shadow">
\t\t\t\t\t<div class="edit-text"></div>
\t\t\t\t</div>
\t\t\t\t<iframe id="bx-block-editor-iframe-#id#" src="" style="border: none;" width="100%" height="100%"></iframe>
\t\t\t</div>
\t\t\t<div class="dialog-part">
\t\t\t\t<div style="overflow-x: hidden;">
\t\t\t\t\t<div class="block-list-cont">
\t\t\t\t\t\t<div class="block-list-tabs">
\t\t\t\t\t\t\t<div class="bx-editor-block-tabs">
\t\t\t\t\t\t\t\t<span class="tab-list">
\t\t\t\t\t\t\t\t\t<span class="tab blocks active">#MESS_BLOCKS#</span>
\t\t\t\t\t\t\t\t\t<span class="tab styles">#MESS_STYLES#</span>
\t\t\t\t\t\t\t\t</span>
\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t<div class="edit-panel-tabs-style">
\t\t\t\t\t\t\t\t<ul class="bx-block-editor-i-place-list" data-bx-place-name="item"></ul>
\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t<div style="clear: both;"></div>
\t\t\t\t\t\t\t<div class="edit-panel-tabs-block">
\t\t\t\t\t\t\t\t<div>#blocks#</div>
\t\t\t\t\t\t\t\t<div style="clear: both;"></div>
\t\t\t\t\t\t\t\t<div class="block-pager adm-nav-pages-block">
\t\t\t\t\t\t\t\t\t<span class="adm-nav-page adm-nav-page-prev #nav-display#"></span>
\t\t\t\t\t\t\t\t\t<span class="adm-nav-page adm-nav-page-next #nav-display#"></span>
\t\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t</div>
\t\t\t\t\t\t\t<div style="clear: both;"></div>
\t\t\t\t\t\t</div>
\t\t\t\t\t\t<div>
\t\t\t\t\t\t</div>
\t\t\t\t\t</div>
\t\t\t\t</div>
\t\t\t</div>
\t\t\t<div class="block-edit-cont">
\t\t\t\t<div class="bx-editor-block-form-head">
\t\t\t\t\t<div class="bx-editor-block-form-head-btn">
\t\t\t\t\t\t<a class="bx-editor-block-tools-btn bx-editor-block-tools-close" title="#MESS_TOOL_SAVE_TITLE#">#MESS_TOOL_SAVE#</a>
\t\t\t\t\t\t<a class="bx-editor-block-tools-btn bx-editor-block-tools-cancel" title="#MESS_TOOL_CANCEL_TITLE#">#MESS_TOOL_CANCEL#</a>
\t\t\t\t\t</div>
\t\t\t\t\t<div class="block-edit-tabs">
\t\t\t\t\t\t<div class="block-edit-tabs-inner">
\t\t\t\t\t\t\t<span data-bx-block-editor-settings-tab="cont" class="bx-editor-block-tab active">#MESS_TOOL_CONTENT#</span>
\t\t\t\t\t\t\t<span data-bx-block-editor-settings-tab="style" class="bx-editor-block-tab">#MESS_TOOL_STYLES#</span>
\t\t\t\t\t\t\t<span data-bx-block-editor-settings-tab="prop" class="bx-editor-block-tab">#MESS_TOOL_SETTINGS#</span>
\t\t\t\t\t\t</div>
\t\t\t\t\t</div>
\t\t\t\t</div>
\t\t\t\t<div class="block-edit-form-empty">
\t\t\t\t\t#MESS_TOOL_EMPTY#
\t\t\t\t</div>
\t\t\t\t<div class="block-edit-form">
\t\t\t\t\t#tools#
\t\t\t\t</div>
\t\t\t</div>
HTML, 'panel-preview' => <<<HTML
\t\t<div class="bx-block-editor-preview-container">
\t\t\t<div class="shadow">
\t\t\t\t<div class="edit-text"></div>
\t\t\t\t<div class="error-text">#MESS_ACCESS_DENIED#</div>
\t\t\t</div>
\t\t\t<div class="devices">
\t\t\t\t#devices#
\t\t\t</div>
\t\t\t<center>
\t\t\t\t<div class="iframe-wrapper">
\t\t\t\t\t<iframe sandbox="allow-same-origin allow-forms" class="preview-iframe" src=""></iframe>
\t\t\t\t</div>
\t\t\t</center>
\t\t</div>
\t\t<div style="clear:both;"></div>
HTML, 'panel-get-html' => <<<HTML
\t\t<textarea style="width: 100%; height: 100%; min-height: 400px;" onfocus="this.select()"></textarea>
HTML)
Methods
__construct()
Create editor object.
public
__construct(array<string|int, mixed> $params) : mixed
Parameters
- $params : array<string|int, mixed>
createInstance()
Return editor object
public
static createInstance(array<string|int, mixed> $params) : Editor
Parameters
- $params : array<string|int, mixed>
Return values
EditorfillDocumentBySliceContent()
Fill template(as a DOM Document) by content.
public
static fillDocumentBySliceContent(Document $document, string $string[, string $encoding = null ]) : bool
Parameters
- $document : Document
-
Document.
- $string : string
-
Content string.
- $encoding : string = null
Tags
Return values
boolfillTemplateBySliceContent()
Fill template(as a HTML) by slice content.
public
static fillTemplateBySliceContent(string $template, string $string[, string $encoding = null ]) : string
Result is string.
Parameters
- $template : string
- $string : string
-
Content string.
- $encoding : string = null
Tags
Return values
stringgetDefaultBlockList()
Return list of default blocks
public
getDefaultBlockList() : array<string|int, mixed>
Return values
array<string|int, mixed>getDefaultToolList()
Return list of default tools, uses for block changing
public
getDefaultToolList() : array<string|int, mixed>
Return values
array<string|int, mixed>getHtmlForEditor()
Return received string, that php changed in special format for block editor.
public
static getHtmlForEditor(string $html[, string $charset = null ]) : string
Parameters
- $html : string
- $charset : string = null
Return values
string —$html
getUI()
Return html of interface part.
public
getUI(string $id, array<string|int, mixed> $values) : string
Parameters
- $id : string
- $values : array<string|int, mixed>
Return values
stringisAvailableRussian()
Return true if can use Russian services.
public
static isAvailableRussian() : bool
Return values
boolisContentSupported()
Check string for the presence of tag attributes that indicates supporting of block editor
public
static isContentSupported(string $content) : bool
Parameters
- $content : string
Return values
boolisHtmlDocument()
Check string for the presence of html
public
static isHtmlDocument(string $content) : bool
Parameters
- $content : string
Return values
boolreplaceCharset()
Replace charset in HTML string.
public
static replaceCharset(string $html[, string $charset = '#CHARSET#' ][, bool $add = false ]) : string
Parameters
- $html : string
- $charset : string = '#CHARSET#'
- $add : bool = false
Return values
string —$html
setBlockList()
Set custom blocks
public
setBlockList(array<string|int, mixed> $blocks) : void
Parameters
- $blocks : array<string|int, mixed>
setComponentFilter()
Set components filter
public
setComponentFilter([array<string|int, mixed> $componentFilter = null ]) : void
Parameters
- $componentFilter : array<string|int, mixed> = null
setToolList()
Set custom tools
public
setToolList(array<string|int, mixed> $tools) : void
Parameters
- $tools : array<string|int, mixed>
show()
Return html for showing editor and include all resources
public
show() : string
Return values
stringshowEditor()
Return html of editor interface without resources.
public
showEditor() : string