Link
Creates internal link
Creates internal link
Show link to orders table:
$link = "<a href='{$this->get('link','table/orders')'>Orders</a>";
$link = "<a href='{$this->get('link','table/customer')}'>";
-->
[base url]/table/customer
Open the customer_info -workspace with given customer information.
$Link = $this->get('link','workspace/customer_info')
->addParam('customer_id','1002');
-->
[base url]/workspace/customer_info/?customer_id=1002
View -variables are saved to server and are visible in $asetus -variable in that view/user only. View -variables can be used for saving view settings, for example a search criteria or tab currently open.
Set customer for customer_info -workspace.
$Link = $this->get('link','workspace/customer_info')
->addViewVar('customer_id',1002);
-->
This will set a variable for current view. It is visible in: $asetus[customer_id].
User -variables are saved to server and are visible in every view for that user. User -variables can be used for saving user settings, for example environmental configuration.
$Link = $this->get('link','workspace/customer_info')
->addUserVar('show_help',false);
-->
This will set a variable for user. It is visible in: $asetus[kayttaja_show_help]
When opening a form for creating a new item (like new page), you can set default values that are set to corresponding fields:
$Link = $this->get('link','table/customer/add')
->addFormVar('title','New page');
-->
This will open a view for adding a new page to customer -table, where title is set to 'New page'.
You can set multiple default values by using addFormVar() method multiple times or/and giving associative array as argument.
$Link = $this->get('link','table/customer/add')
->addFormVar('title','New page')
->addFormVar('description','This is a new page')
->addFormVar(Array(
'price' => '100',
'status' => 'New'
)
);
-->
title: New Page
description: This is a new page
price: 100
status: New
If return link is set, it is used after target views form has been sent, overriding the custom return link for that view.
$Link = $this->get('link','table/customer/page/1002')
->setReturnLink('workspace/new_customers');
If you don't set any arguments, current view is used.
$Link = $this->get('link','table/customer/page/1002')
->setReturnLink();
Return link is Link -object, so you can create return link first and then add it to main link.
$returnLink = $this->get('link','workspace/new_customers')
->addParam('source','customer_form');
$Link = $this->get('link','table/customer/page/1002')
->setReturnLink( $returnLink );
Goto new customer -page.
$this->get('link','table/customer/page/add')->open();
Link -class is chainable. ie. all methods that returns 'this' can be written in chain.
Method | Return type | Description |
---|---|---|
setPath(path) | this | Clear path and add new path. |
addPath(path) | this | Add segment(s) to path. |
setPathSegment(string,index) | this | Replace path segment in certain level (starts form 1). |
setLastPathSegment(string) | this | Replace last segment in path. |
addParam(params) | this | Add url parameters. |
addFormVar(params) | this | Add url parameters that are set as default values when opening a form. |
addViewVar(params) | this | Add url parameters that are visible for current user in current view. |
addUserVar(params) | this | Add url parameters that are visible for current user in all views. |
setReturnLink([path/eLink]) | this | Add return link that is added to url params. |
url() | string | Returns url. (Objects string value.) |
open() | - | Goto url in link. |