Piwik\View\
Base type of UI controls.
The JavaScript companion class can be found in plugins/CoreHome/javascripts/uiControl.js.
This class defines the following constants:
TEMPLATE
Derived classes must set this constant.
This class defines the following properties:
$sendHeadersWhenRendering
ash; Can be disabled to not send headers when rendering a view. Inherited from View
$cssIdentifier
— The CSS class that is used to map the root element of this control with the JavaScript class.$jsClass
— The name of the JavaScript class that handles the behavior of this control.$jsNamespace
— The JavaScript module that contains the JavaScript class.$cssClass
— Extra CSS class(es) for the root element.$htmlAttributes
— HTML Attributes for the root element$sendHeadersWhenRendering
Can be disabled to not send headers when rendering a view. This can be useful if heaps of views are being rendered during one request to possibly prevent a segmentation fault see eg #15307 . It should not be disabled for a main view, but could be disabled for views that are being rendered eg during a twig event as a "subview" which is part of the "main view".
bool
value.$cssIdentifier
The CSS class that is used to map the root element of this control with the JavaScript class.
This field must be set prior to rendering.
string
value.$jsClass
The name of the JavaScript class that handles the behavior of this control.
This field must be set prior to rendering.
string
value.$jsNamespace
The JavaScript module that contains the JavaScript class.
string
value.$cssClass
Extra CSS class(es) for the root element.
string
value.$htmlAttributes
HTML Attributes for the root element
string
value.The class defines the following methods:
__construct()
— Constructor.disableCacheBuster()
ash; Disables the cache buster (adding of ?cb=. Inherited from View
getTemplateFile()
ash; Returns the template filename. Inherited from View
getTemplateVars()
— See View::getTemplateVars().__set()
— Sets a variable.__get()
— Gets a view variable.__isset()
— Returns true if a template variable has been set or not.__unset()
ash; Unsets a template variable. Inherited from View
render()
— Renders the control view within a containing<
div> that is used by the UIControl JavaScript class.
- setContentType()
ash; Set stored value used in the Content-Type HTTP header field. Inherited from View
- setXFrameOptions()
ash; Set X-Frame-Options field in the HTTP response. Inherited from View
- singleReport()
ash; Creates a View for and then renders the single report template. Inherited from View
- getUseStrictReferrerPolicy()
ash; Returns whether a strict Referrer-Policy header will be sent. Inherited from View
- setUseStrictReferrerPolicy()
ash; Sets whether a strict Referrer-Policy header will be sent (if not, nothing is sent). Inherited from View
- getClientSideProperties()
— Returns the array of property names whose values are passed to the UIControl JavaScript class.
- getClientSideParameters()
— Returns an array of property names whose values are passed to the UIControl JavaScript class.
__construct()
Constructor.
disableCacheBuster()
Disables the cache buster (adding of ?cb=.
..) to JavaScript and stylesheet files
getTemplateFile()
Returns the template filename.
string
value.getTemplateVars()
See View::getTemplateVars().
$override
(array
) —
Template variable override values. Mainly useful when including View templates in other templates.array
value.__set()
Sets a variable. See View::__set().
$key
(string
) —
The variable name.$val
(mixed
) —
The variable value.__get()
Gets a view variable. See View::__get().
It accepts the following parameter(s):
$key
(string
) —
The variable name.Returns: mixed
—
The variable value.
__isset()
Returns true if a template variable has been set or not.
It accepts the following parameter(s):
$key
It returns a bool
value.
__unset()
Unsets a template variable.
$name
(string
) —
The name of the template variable.render()
Renders the control view within a containing
<
div> that is used by the UIControl JavaScript class.
string
—
Serialized data, eg, (image, array, html...).setContentType()
Set stored value used in the Content-Type HTTP header field. The header is set just before rendering.
It accepts the following parameter(s):
$contentType
(string
) —It does not return anything or a mixed result.
setXFrameOptions()
Set X-Frame-Options field in the HTTP response. The header is set just before rendering.
Note: setting this allows you to make sure the View cannot be embedded in iframes. Learn more here.
$option
(string
) —
('deny' or 'sameorigin')singleReport()
Creates a View for and then renders the single report template.
Can be used for pages that display only one report to avoid having to create a new template.
It accepts the following parameter(s):
$title
(string
) —
The report title.$reportHtml
(string
) —
The report body HTML.Returns: string
|void
—
The report contents if $fetch
is true.
getUseStrictReferrerPolicy()
Returns whether a strict Referrer-Policy header will be sent. Generally this should be set to 'true'.
bool
value.setUseStrictReferrerPolicy()
Sets whether a strict Referrer-Policy header will be sent (if not, nothing is sent).
It accepts the following parameter(s):
$useStrictReferrerPolicy
(bool
) —It does not return anything or a mixed result.
getClientSideProperties()
Returns the array of property names whose values are passed to the UIControl JavaScript class.
Should be overridden by descendants.
array
value.getClientSideParameters()
Returns an array of property names whose values are passed to the UIControl JavaScript class.
These values differ from those in $clientSideProperties in that they are meant to passed as request parameters when the JavaScript code makes an AJAX request.
Should be overridden by descendants.
array
value.