Alpha Framework 4.0.0 API Documentation

RendererProviderInterface

Defines the renderer interface, which allows us to have various implementations (HTML, JSON, XML etc.) behind one unified interface. Use the ServiceFactory::getInstance() method to get instances of this.

Tags
since
1.2
author

John Collins dev@alphaframework.org

license

http://www.opensource.org/licenses/bsd-license.php The BSD License

copyright

Copyright (c) 2021, John Collins (founder of Alpha Framework). All rights reserved.

Redistribution and use in source and binary forms, with or
without modification, are permitted provided that the
following conditions are met:

* Redistributions of source code must retain the above
  copyright notice, this list of conditions and the
  following disclaimer.
* Redistributions in binary form must reproduce the above
  copyright notice, this list of conditions and the
  following disclaimer in the documentation and/or other
  materials provided with the distribution.
* Neither the name of the Alpha Framework nor the names
  of its contributors may be used to endorse or promote
  products derived from this software without specific
  prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Table of Contents

Methods

adminView()  : string
Renders the admin view for the Record using the selected renderer.
createView()  : string
Renders the create view for the Record using the selected renderer.
detailedView()  : string
Renders the detailed read-only view for the Record using the selected renderer.
displayErrorMessage()  : string
Renders an error (e.g. save failed) message.
displayPageFoot()  : string
Renders the footer content using the given renderer.
displayPageHead()  : string
Renders the header content using the given renderer.
displayUpdateMessage()  : string
Renders an update (e.g. successful save) message.
editView()  : string
Renders the edit view for the Record using the selected renderer.
listView()  : string
Renders the list view for the Record using the selected renderer.
renderAllFields()  : string
Convenience method that renders all fields for the current Record in edit/create/view mode.
renderBooleanField()  : string
Renders an Boolean field value.
renderDefaultField()  : string
Method to render a field when type is not known.
renderDeleteForm()  : string
Method to render a hidden HTML form for posting the ID of an object to be deleted.
renderDEnumField()  : string
Renders an DEnum field value.
renderDoubleField()  : string
Renders an Double field value.
renderEnumField()  : string
Renders an Enum field value.
renderErrorPage()  : string
Renders an error page with the supplied HTTP error code and a message.
renderIntegerField()  : string
Renders an Integer field value.
renderRelationField()  : string
Renders a Relation field value.
renderSecurityFields()  : string
Method to render a HTML form with two hidden, hashed (MD5) form fields to be used as a check to ensure that a post to the controller is being sent from the same server as hosting it.
renderStringField()  : string
Renders a String field value.
renderTextField()  : string
Renders a Text field value.
setRecord()  : void
Provide the Record that we are going render.

Methods

adminView()

Renders the admin view for the Record using the selected renderer.

public adminView([array<string|int, mixed> $fields = array() ]) : string
Parameters
$fields : array<string|int, mixed> = array()

Hash array of fields to pass to the template.

Tags
since
1.2
Return values
string

createView()

Renders the create view for the Record using the selected renderer.

public createView([array<string|int, mixed> $fields = array() ]) : string
Parameters
$fields : array<string|int, mixed> = array()

Hash array of fields to pass to the template.

Tags
since
1.2
Return values
string

detailedView()

Renders the detailed read-only view for the Record using the selected renderer.

public detailedView([array<string|int, mixed> $fields = array() ]) : string
Parameters
$fields : array<string|int, mixed> = array()

Hash array of fields to pass to the template.

Tags
since
1.2
Return values
string

displayErrorMessage()

Renders an error (e.g. save failed) message.

public static displayErrorMessage(string $message) : string
Parameters
$message : string
Tags
since
1.2
Return values
string

displayUpdateMessage()

Renders an update (e.g. successful save) message.

public static displayUpdateMessage(string $message) : string
Parameters
$message : string
Tags
since
1.2
Return values
string

editView()

Renders the edit view for the Record using the selected renderer.

public editView([array<string|int, mixed> $fields = array() ]) : string
Parameters
$fields : array<string|int, mixed> = array()

Hash array of fields to pass to the template.

Tags
since
1.2
Return values
string

listView()

Renders the list view for the Record using the selected renderer.

public listView([array<string|int, mixed> $fields = array() ]) : string
Parameters
$fields : array<string|int, mixed> = array()

Hash array of fields to pass to the template.

Tags
since
1.2
Return values
string

renderAllFields()

Convenience method that renders all fields for the current Record in edit/create/view mode.

public renderAllFields(string $mode[, array<string|int, mixed> $filterFields = array() ][, array<string|int, mixed> $readOnlyFields = array() ]) : string
Parameters
$mode : string

(view|edit|create)

$filterFields : array<string|int, mixed> = array()

Optional list of field names to exclude from rendering.

$readOnlyFields : array<string|int, mixed> = array()

Optional list of fields to render in a readonly fashion when rendering in create or edit mode.

Tags
since
1.2
Return values
string

renderBooleanField()

Renders an Boolean field value.

public renderBooleanField(string $name, string $label, string $mode[, string $value = '' ]) : string
Parameters
$name : string

The field name

$label : string

The label to apply to the field

$mode : string

The field mode (create/edit/view)

$value : string = ''

The field value (optional)

Tags
since
1.2
Return values
string

renderDefaultField()

Method to render a field when type is not known.

public renderDefaultField(string $name, string $label, string $mode[, string $value = '' ]) : string
Parameters
$name : string

The field name

$label : string

The label to apply to the field

$mode : string

The field mode (create/edit/view)

$value : string = ''

The field value (optional)

Tags
since
1.2
Return values
string

renderDeleteForm()

Method to render a hidden HTML form for posting the ID of an object to be deleted.

public static renderDeleteForm(string $URI) : string
Parameters
$URI : string

The URI that the form will point to

Tags
since
1.2
Return values
string

renderDEnumField()

Renders an DEnum field value.

public renderDEnumField(string $name, string $label, string $mode, array<string|int, mixed> $options[, string $value = '' ]) : string
Parameters
$name : string

The field name

$label : string

The label to apply to the field

$mode : string

The field mode (create/edit/view)

$options : array<string|int, mixed>

The DEnum options

$value : string = ''

The field value (optional)

Tags
since
1.2
Return values
string

renderDoubleField()

Renders an Double field value.

public renderDoubleField(string $name, string $label, string $mode[, string $value = '' ]) : string
Parameters
$name : string

The field name

$label : string

The label to apply to the field

$mode : string

The field mode (create/edit/view)

$value : string = ''

The field value (optional)

Tags
since
1.2
Return values
string

renderEnumField()

Renders an Enum field value.

public renderEnumField(string $name, string $label, string $mode, array<string|int, mixed> $options[, string $value = '' ]) : string
Parameters
$name : string

The field name

$label : string

The label to apply to the field

$mode : string

The field mode (create/edit/view)

$options : array<string|int, mixed>

The Enum options

$value : string = ''

The field value (optional)

Tags
since
1.0
Return values
string

renderErrorPage()

Renders an error page with the supplied HTTP error code and a message.

public static renderErrorPage(string $code, string $message) : string
Parameters
$code : string
$message : string
Tags
since
1.2
Return values
string

renderIntegerField()

Renders an Integer field value.

public renderIntegerField(string $name, string $label, string $mode[, string $value = '' ]) : string
Parameters
$name : string

The field name

$label : string

The label to apply to the field

$mode : string

The field mode (create/edit/view)

$value : string = ''

The field value (optional)

Tags
since
1.2
Return values
string

renderRelationField()

Renders a Relation field value.

public renderRelationField(string $name, string $label, string $mode[, string $value = '' ][, bool $expanded = false ][, bool $buttons = true ]) : string
Parameters
$name : string

The field name

$label : string

The label to apply to the field

$mode : string

The field mode (create/edit/view)

$value : string = ''

The field value (optional)

$expanded : bool = false

Render the related fields in expanded format or not (optional)

$buttons : bool = true

Render buttons for expanding/contacting the related fields (optional)

Tags
since
1.2
Return values
string

renderSecurityFields()

Method to render a HTML form with two hidden, hashed (MD5) form fields to be used as a check to ensure that a post to the controller is being sent from the same server as hosting it.

public static renderSecurityFields() : string
Tags
since
1.2
Return values
string

renderStringField()

Renders a String field value.

public renderStringField(string $name, string $label, string $mode[, string $value = '' ]) : string
Parameters
$name : string

The field name

$label : string

The label to apply to the field

$mode : string

The field mode (create/edit/view)

$value : string = ''

The field value (optional)

Tags
since
1.2.2
Return values
string

renderTextField()

Renders a Text field value.

public renderTextField(string $name, string $label, string $mode[, string $value = '' ]) : string
Parameters
$name : string

The field name

$label : string

The label to apply to the field

$mode : string

The field mode (create/edit/view)

$value : string = ''

The field value (optional)

Tags
since
1.0
Return values
string

        
On this page

Search results