Example:
$this->ViewExtension->menuHeaderPage($headerMenuActions);
Where $headerMenuActions
- array of actions links, e.g.:
$headerMenuActions = [
$this->ViewExtension->menuActionLink(
'far fa-trash-alt',
__('Delete data'),
['controller' => 'some_controller', 'action' => 'delete', $data['SomeModel']['id']],
[
'title' => __('Delete profile'), 'action-type' => 'confirm-post',
'data-confirm-msg' => __('Are you sure you wish to delete this data?'),
]
),
'divider',
$this->ViewExtension->menuActionLink(
'fas fa-download',
__('Download XML data'),
['controller' => 'some_controller', 'action' => 'download', $data['SomeModel']['id'], 'ext' => 'xml'],
[
'title' => __('Download XML file'),
'skip-modal' => true
]
),
];
echo $this->ViewExtension->menuHeaderPage($headerMenuActions);
For using page header and small menu of actions:
echo $this->ViewExtension->headerPage($pageHeader, $headerMenuActions);
Where
$pageTitle
- string title of page;$headerMenuActions
- array of actions links.
Add HTML options to element:
['data-toggle' => 'tooltip', 'title' => 'Some tooltip']
;['data-toggle' => 'someToggle', 'title' => 'Some tooltip']
;['data-tooltip-text' => Some tooltip]
Example:
echo $this->Html->link('some link', '/', ['data-toggle' => 'tooltip', 'title' => 'Some tooltip']);
Example:
$this->ViewExtension->timeAgo($time, $format);
Where:
$time
UNIX timestamp, strtotime() valid string or DateTime object$format
strftime format string
Add HTML options to element: ['data-toggle' => 'repeat']
Example:
echo $this->Html->div('some-class', 'Data to update', ['data-toggle' => 'repeat']);
Example:
echo $this->ViewExtension->buttonPrint();
Example:
echo $this->ViewExtension->yesNo($data);
$listYesNo = $this->ViewExtension->yesNoList();
Example:
echo $this->ViewExtension->showEmpty($data, $dataRet, $emptyRet, $isHtml);
Where:
$data
- Data for checking$dataRet
- Data for return, if target data is not empty. Default - target data$emptyRet
- Data for return, if target data is empty (default -<None>
)$isHtml
- Flag of trimmings HTML tags from result, if False
Example:
echo $this->ViewExtension->iconTag($icon, $options);
Where:
$icon
- Class of icon$options
- HTML options for icon element See http://fontawesome.io
Example:
echo $this->ViewExtension->button($icon, $btn, $options);
Where:
$icon
- Class of icon$btn
- Class of button$options
- HTML options for button element See http://fontawesome.io
Example:
echo $this->ViewExtension->addUserPrefixUrl($url);
Where:
$url
- URL for adding prefix
Example:
echo $this->ViewExtension->getIconForExtension($extension);
Where:
$extension
- Extension of file`
Example:
echo $this->ViewExtension->truncateText($text, $length);
Where:
$text
- Text to truncate$length
- Length of returned string
Require plugin Tools
. Use the composer to install:
composer require dereuromark/cakephp-tools:^0.12.3
Example:
echo $this->ViewExtension->numberText($number, $langCode);
Where:
$number
- Number for processing$langCode
- Languge code in formatISO 639-1
orISO 639-2
Example:
echo $this->ViewExtension->barState($stateData);
Where:
$stateData
- Array of state in format:- key
stateName
, value: name of state; - key
stateId
, value: ID of state; amount
, value: amount elements in this state- key
stateUrl
, value: url for state, e.g.: array('controller' => 'posts', 'action' => 'index', '?' => array('data[FilterData][0][Post][state_id]' => '2')) [Not necessary] - key
class
: ID of state, value: class of state for progress bar, e.g.: 'progress-bar-danger progress-bar-striped' [Not necessary]
- key
Example:
echo $this->ViewExtension->listLastInfo($lastInfo, $labelList, $controllerName, $actionName, $length);
Where:
$lastInfo
- Array of last information in format:- key
label
, value: label of list item; - key
modified
, value: date and time of last modification; - key
id
, value: ID of record.
- key
$labelList
- Label of list$controllerName
- Name of controller for viewing$actionName
- Name of controller action for viewing$length
- Length of list item label string
Example:
echo $this->ViewExtension->collapsibleList($listData, $showLimit, $listClass, $listTag);
Where:
$listData
- List data$showLimit
- Limit of the displayed list$listClass
- Class of the list tag$listTag
- Type of list tag to use (ol/ul)