Description
...
null buttonblock(string $titleint $location, string $route, Closure $callback)
Creates the an action button for your section. Usually used when you want a user to add an item.
Info | ||
---|---|---|
| ||
This function requires setting the section name beforehand by using the section() function. |
Parameters
$name
Title for your button.
$route
URL route to the page.
...
Requires: phpFox 4.3+
Creates a block in specific locations and routes.
Parameters
...
$location
Block location number.
$route
Route to place the block.
$callback
Callback function that will be executed when the block is to be loaded.
Examples
...
Code Block | ||
---|---|---|
| ||
<?php route('/foo/** * Adds a block to the sites dashboard when a user is logged in. */ block(1, 'core.index-member', function() { $html = '<div class="block"><div class="title">Hello World!</div><div class="content">...</div></div>'; Must set the section firstreturn $html; }); /** * Adds a block in video section. */ block('Foo3, 'route_v', function() { $html = '/foo'<div class="block"><div class="title">Hello World!</div><div class="content">...</div></div>'; return $html; }); //** Create an action menu button('Create', '/foo/bar'); * Adds a block to the poll section using an HTML view */ block(3, 'poll.index', function() { return view('index@Sample/block.html'); }); |
Notes
...
Since 4.3+
Blocks are not required to be included in a route and is no longer the advised way to create a block. While old methods are still supported in 4.3, they will be depreciated in the future. The change in how blocks work in 4.3 is to give clients the ability to re-position your blocks from the AdminCP.
HTML Views
If you use an HTML view via the view() function you must prefix the HTML with your apps ID (e.g. @Sample/)
Identifying Route Names
Finding the name of a route can be hard at times, enable Techie Mode to make things easier.