Automad
 All Classes Functions Variables Pages
Automad\Core\Toolbox Class Reference

Public Member Functions

 __construct ($Automad)
 
 bootstrapCSS ()
 
 bootstrapJS ()
 
 filelist ($options=array())
 
 filterParentByTags ()
 
 img ($options=array())
 
 imgSet ($options=array())
 
 jquery ()
 
 level ()
 
 linkPrev ($options=array())
 
 linkNext ($options=array())
 
 listConfig ($options=array())
 
 listCount ()
 
 listPages ($options=array())
 
 listFilters ()
 
 listSort ($options=array())
 
 metaTitle ($options=array())
 
 navBelow ($options=array())
 
 navBreadcrumbs ($options=array())
 
 navChildren ($options=array())
 
 navPerLevel ($options=array())
 
 navSiblings ($options=array())
 
 navTop ($options=array())
 
 navTree ($options=array())
 
 pagelist ($options=array())
 
 pagelistFilters ()
 
 pagelistMarkup ($options=array())
 
 pagelistSort ($options=array())
 
 search ($options=array())
 
 template ()
 
 themeURL ()
 
 year ()
 

Private Attributes

 $Automad
 
 $collection
 

Detailed Description

The Toolbox class holds all methods to be used within the template files.

Author
Marc Anton Dahmen hello.nosp@m.@mar.nosp@m.cdahm.nosp@m.en.d.nosp@m.e
License
MIT license - http://automad.org/license

Definition at line 52 of file toolbox.php.

Constructor & Destructor Documentation

Automad\Core\Toolbox::__construct (   $Automad)

The Automad object is passed as an argument. It shouldn't be created again (performance).

Definition at line 73 of file toolbox.php.

References Automad\Core\Automad\getCollection().

Member Function Documentation

Automad\Core\Toolbox::bootstrapCSS ( )

Load Twitter's Bootstrap CSS.

Returns
the script tag to include the minified bootstrap CSS

Definition at line 87 of file toolbox.php.

Automad\Core\Toolbox::bootstrapJS ( )

Load Twitter's Bootstrap JavaScript.

Returns
the script tag to include the minified bootstrap JS

Definition at line 100 of file toolbox.php.

Automad\Core\Toolbox::filelist (   $options = array())

Configure the filelist to be used in foreach loops.

Parameters
array$options

Definition at line 113 of file toolbox.php.

References Automad\Core\Automad\getFilelist().

Automad\Core\Toolbox::filterParentByTags ( )

Place a set of the current page's tags and link back to the parent page passing each tag as a filter.

Returns
the HTML of the filters

Definition at line 126 of file toolbox.php.

References Automad\Core\Html\generateFilterMenu().

Automad\Core\Toolbox::img (   $options = array())

Place an image with an optional link.

Parameters
array$options- (file: path/to/file (or glob pattern), width: px, height: px, crop: 1, link: url, target: _blank)
Returns
HTML for the image output

Definition at line 140 of file toolbox.php.

References Automad\Core\Html\addImage(), and Automad\Core\Resolve\filePath().

Automad\Core\Toolbox::imgSet (   $options = array())

Place a set of resized images, linking to their original sized version. This tool returns the basic HTML for a simple image gallery.

Possible options:

  • files: filepath/glob (multiple separated by space)
  • width: pixels
  • height: pixels
  • crop: false
  • order: "asc", "desc" or false
  • class: wrapping class
  • firstWidth: width of first image
  • firstHeight: height of firste image
  • firstClass: wrapping class of first image
  • enlargedWidth: width of enlarged image
  • enlargedHeight: height of enlarged image
Parameters
array$options
Returns
The HTML of a list of resized images with links to their bigger versions

Definition at line 195 of file toolbox.php.

References Automad\Core\Parse\fileDeclaration(), and Automad\Core\Html\generateImageSet().

Automad\Core\Toolbox::jquery ( )

Load Jquery JS library.

Returns
the script tag to include Jquery

Definition at line 248 of file toolbox.php.

Automad\Core\Toolbox::level ( )

Return the level of the current page.

Deprecated:
This method is deprecated since version 0.11 and will be removed in the future.
Returns
level

Definition at line 262 of file toolbox.php.

Automad\Core\Toolbox::linkNext (   $options = array())

Place a link to the next sibling.

Parameters
array$options- (text: Text to be displayed instead of page title (optional))
Returns
the HTML for the link.

Definition at line 304 of file toolbox.php.

References Automad\Core\Html\addLink().

Automad\Core\Toolbox::linkPrev (   $options = array())

Place a link to the previous sibling.

Parameters
array$options- (text: Text to be displayed instead of page title (optional))
Returns
the HTML for the link.

Definition at line 276 of file toolbox.php.

References Automad\Core\Html\addLink().

Automad\Core\Toolbox::listConfig (   $options = array())

Alias for pagelist().

Deprecated:
This method is deprecated since version 0.11 and will be removed in the future.
Parameters
array$options

Definition at line 332 of file toolbox.php.

Automad\Core\Toolbox::listCount ( )

Return the number of pages in the Pagelist object.

Deprecated:
This method is deprecated since version 0.11 and will be removed in the future.
Returns
count($this->Pagelist->pages)

Definition at line 346 of file toolbox.php.

References Automad\Core\Automad\$Pagelist, and Automad\Core\Automad\getPagelist().

Automad\Core\Toolbox::listFilters ( )

Alias for pagelistFilters().

Deprecated:
This method is deprecated since version 0.11 and will be removed in the future.
Returns
The HTML for the filter menu.

Definition at line 376 of file toolbox.php.

Automad\Core\Toolbox::listPages (   $options = array())

Alias for pagelistMarkup().

Deprecated:
This method is deprecated since version 0.11 and will be removed in the future.
Parameters
array$options
Returns
The HTML for a page list.

Definition at line 362 of file toolbox.php.

Automad\Core\Toolbox::listSort (   $options = array())

Alias for pagelistSort().

Deprecated:
This method is deprecated since version 0.11 and will be removed in the future.
Parameters
array$options- A multidimensional array of buttons and their sort settings
Returns
The menu's HTML

Definition at line 391 of file toolbox.php.

Automad\Core\Toolbox::metaTitle (   $options = array())

Create the meta title tag form the site name and the page title. If the 'title' option is defined, use that title instead to override the default site/page combination.

Parameters
array$options('title')
Returns
The meta title tag

Definition at line 406 of file toolbox.php.

References Automad\Core\Automad\getValue().

Automad\Core\Toolbox::navBelow (   $options = array())

Generate a list for the navigation below a given URL.

Parameters
array$options- (parent: the URL of the parent page of the displayed pages; homepage: add the homepage, if parent is '/' (true/false); class: wrapping class)
Returns
html of the generated list

Definition at line 430 of file toolbox.php.

References Automad\Core\Html\generateNav().

Automad\Core\Toolbox::navBreadcrumbs (   $options = array())

Generate breadcrumbs to the current page, if the page's level is > 0 (not homepage / search results / page not found).

Parameters
array$options- (separator: "string")
Returns
html of breadcrumb navigation

Definition at line 463 of file toolbox.php.

References Automad\Core\Html\generateBreadcrumbs().

Automad\Core\Toolbox::navChildren (   $options = array())

Generate a list for the navigation below the current page.

Parameters
array$options- options to be passed to navBelow() (basically only 'class')
Returns
html of the generated list

Definition at line 486 of file toolbox.php.

Automad\Core\Toolbox::navPerLevel (   $options = array())

Generate a seperate navigation menu for each level within the current path.

Parameters
array$options- (levels: The maximal level to display, homepage: show the homepage for the 1st level)
Returns
the HTML for the seperate navigations

Definition at line 501 of file toolbox.php.

Automad\Core\Toolbox::navSiblings (   $options = array())

Generate a list for the navigation below the current page's parent.

Parameters
array$options- $options['homepage'] = true/false (Show the homepage as well with the 1st level siblings)
Returns
html of the generated list

Definition at line 534 of file toolbox.php.

Automad\Core\Toolbox::navTop (   $options = array())

Generate a list for the navigation at the top level including the home page (level 0 & 1).

Parameters
array$options- $options['homepage'] = true/false (Show the homepage as well in the naviagtion)
Returns
html of the generated list

Definition at line 549 of file toolbox.php.

Automad\Core\Toolbox::navTree (   $options = array())

Generate full navigation tree.

Parameters
array$options- (all: expand all pages (boolean), parent: "/parenturl", rootLevel: integer)
Returns
the HTML of the tree

Definition at line 564 of file toolbox.php.

References Automad\Core\Html\generateTree().

Automad\Core\Toolbox::pagelist (   $options = array())

Change of configuration for Automad's Pagelist object.

Possible options are:

  • type: sets the type of pagelist (default is all pages),
    • false (all)
    • "children" (only pages below the current)
    • "related" (all pages with common tags)
    • "siblings" (same parent)
    • "breadcrumbs" (all (parent) pages in the current URL)
  • parent: optional URL of parent page, if type is set to children - default is always the current page
  • template: include only pages matching that template
  • sortItem: Variable to sort by - default sort item, when there is no query string passed
  • sortOrder: "asc" or "desc" - default sort order, when there is no query string passed
  • offset: offset the within the array of all relevant pages
  • limit: limit the object's array of relevant pages
Parameters
array$options

Definition at line 623 of file toolbox.php.

References Automad\Core\Automad\getPagelist().

Automad\Core\Toolbox::pagelistFilters ( )

Create a filter menu for the pages in Automad's Pagelist object.

Returns
The HTML for the filter menu.

Definition at line 636 of file toolbox.php.

References Automad\Core\Html\generateFilterMenu(), and Automad\Core\Automad\getPagelist().

Automad\Core\Toolbox::pagelistMarkup (   $options = array())

Return the markup for a page list from the Pagelist object.

Possible options are:

  • class: Wrapping class for all list items
  • variables: Variables to be displayed
  • glob: File patter to match thumbnail image
  • width: The thumbnails' width
  • height: The thumbnails' height
  • crop: Cropping parameter for thumbnails
  • maxChars: Maximum number of characters for each variable
  • header: The list's header text
  • style: An array of inline styles of each item, where the key is the property and the value is the name of the page variable - for example: { color: "color_var", background-color: "bg_color_var"}
  • firstClass: special class for the first item of the list
  • firstWidth: width for the image of the first list item
  • firstHeight: height for the image of the first list item
  • offset: offset within the array of filtered/sorted pages
  • limit: limit the output of listed pages
Parameters
array$options
Returns
The HTML for a page list.

Definition at line 666 of file toolbox.php.

References Automad\Core\Automad\$Pagelist, Automad\Core\Html\generatePagelist(), and Automad\Core\Automad\getPagelist().

Automad\Core\Toolbox::pagelistSort (   $options = array())

To have a button to sort the pages by basename, the 'sortItem' just has to be skipped or set to any non-existing variable.

Parameters
array$options- A multidimensional array of buttons and their sort settings
Returns
The menu's HTML

Definition at line 728 of file toolbox.php.

References Automad\Core\Html\generateSortMenu().

Automad\Core\Toolbox::search (   $options = array())

Place a search field with placeholder text.

Parameters
array$options
Returns
the HTML of the searchfield

Definition at line 765 of file toolbox.php.

References Automad\Core\Html\generateSearchField().

Automad\Core\Toolbox::template ( )

Return the template name used by the current page.

Returns
template name

Definition at line 795 of file toolbox.php.

Automad\Core\Toolbox::themeURL ( )

Return the URL of the page theme.

Returns
page theme URL

Definition at line 808 of file toolbox.php.

Automad\Core\Toolbox::year ( )

Return the current year.

Returns
current year

Definition at line 821 of file toolbox.php.

Member Data Documentation

Automad\Core\Toolbox::$Automad
private

Automad object.

Definition at line 59 of file toolbox.php.

Automad\Core\Toolbox::$collection
private

The full collection of pages.

Definition at line 66 of file toolbox.php.


The documentation for this class was generated from the following file: