FUEL CMS User Guide : Version 1.4


Fuel Blocks Class

This class extends the Fuel_module class.

Properties Reference

Property Default Value Description
public
blocks_folder _blocks
protected
module N/A

Function Reference [+]

$this->fuel->blocks->render('$params', [$vars=array()], ['$check_db'=TRUE], ['$scope'=NULL])

Allows you to load a view and pass data to it. Renders a navigation structure using the http://docs.getfuelcms.com//libraries/menu">Menu class. The http://docs.getfuelcms.com//helpers/fuel_helper">fuel_block helper function is an alias to this method.

  • view - the name of the view block file. Also can be the first parameter of the method
  • vars: an array of variables to pass to the block. Also can be the second parameter of the method.
  • scope: a string value used for placing the variables into a certain scope to prevent conflict with other loaded variables. Default behavior will load variables in to a global context. The value of TRUE will generate one for you.
  • view_string - a string variable that represents the block
  • model - the name of a model to automatically load for the block
  • find - the name of the find method to run on the loaded model
  • select - select parameters to run for the find method
  • where - where parameters to run for the find method
  • order - the order the find method should return
  • limit - the limit number of results to be returned by the find method
  • offset - the find results returned offset value
  • return_method: the return method the find query should use
  • assoc_key: the column name to be used as the associative key in the find method
  • data: the data values to be passed to the block. This variable get's automatically set if you specify the model and find method
  • editable: css class styles to apply to menu items... can be a nested array
  • parse: determines whether to parse the contents of the block. The default is set to 'auto'
  • cache: determines whether to cache the block. Default is false
  • mode: explicitly will look in either the CMS or the views/_blocks folder
  • module: the name of the module to look in for the block
  • language: the language version to use for the block. Must be a value specified found in the 'languages' options in the FUEL configuration
  • use_default: determines whether to find a non-language specified version of a block with the same name if the specified language version is not available in the CMS

Returns

string

Parameters

(mixed) $params Array of parameters
(array) $vars Array of variables
(boolean) $check_db Determines whether to check the CMS for the block or not (alternative to using the "mode" parameter)
(boolean) $scope Determines whether to scope the variables. A string can also be passed otherwise the scope value will be created for you

$this->fuel->blocks->import('$block', ['$sanitize'=TRUE])

Imports a block view file into the database.

Returns

string

Parameters

(string) $block The name of the block file to import to the CMS
(boolean) $sanitize Determines whether to sanitize the block by applying the php to template syntax function before uploading

$this->fuel->blocks->options_list([$where=array()], ['$dir_folder'=''], ['$dir_filter'='^_(.*)|\.html$'], ['$order'=TRUE], ['$recursive'=TRUE])

Returns an associative array of all blocks with from both the CMS and static views in the views/_blocks/ folder.

Returns

array

Parameters

(array) $where Where condition to apply to blocks in the CMS (optional)
(string) $dir_folder The subfolder within the views/_blocks folder (optional)
(string) $dir_filter Filter condition for those blocks found in the views/_blocks folder (optional)
(mixed) $order The ordering condition to apply for the views (applies to those fond in the CMS... optional)
(boolean) $recursive Determines whether to recursively look for files (optional)

$this->fuel->blocks->mode()

Returns the rendering mode for the blocks module (e.g. views or cms).

Returns

boolean