Source for file link.php

Documentation is available at link.php

  1. <?php
  2. /**
  3.  * @package     Joomla.Libraries
  4.  * @subpackage  Toolbar
  5.  *
  6.  * @copyright   Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
  7.  * @license     GNU General Public License version 2 or later; see LICENSE
  8.  */
  9.  
  10. defined('JPATH_PLATFORM'or die;
  11.  
  12. /**
  13.  * Renders a link button
  14.  *
  15.  * @package     Joomla.Libraries
  16.  * @subpackage  Toolbar
  17.  * @since       3.0
  18.  */
  19. {
  20.     /**
  21.      * Button type
  22.      * @var    string 
  23.      */
  24.     protected $_name = 'Link';
  25.  
  26.     /**
  27.      * Fetch the HTML for the button
  28.      *
  29.      * @param   string  $type  Unused string.
  30.      * @param   string  $name  Name to be used as apart of the id
  31.      * @param   string  $text  Button text
  32.      * @param   string  $url   The link url
  33.      *
  34.      * @return  string  HTML string for the button
  35.      *
  36.      * @since   3.0
  37.      */
  38.     public function fetchButton($type 'Link'$name 'back'$text ''$url null)
  39.     {
  40.         // Store all data to the options array for use with JLayout
  41.         $options array();
  42.         $options['text'JText::_($text);
  43.         $options['class'$this->fetchIconClass($name);
  44.         $options['doTask'$this->_getCommand($url);
  45.  
  46.         // Instantiate a new JLayoutFile instance and render the layout
  47.         $layout new JLayoutFile('joomla.toolbar.link');
  48.  
  49.         return $layout->render($options);
  50.     }
  51.  
  52.     /**
  53.      * Get the button CSS Id
  54.      *
  55.      * @param   string  $type  The button type.
  56.      * @param   string  $name  The name of the button.
  57.      *
  58.      * @return  string  Button CSS Id
  59.      *
  60.      * @since   3.0
  61.      */
  62.     public function fetchId($type 'Link'$name '')
  63.     {
  64.         return $this->_parent->getName('-' $name;
  65.     }
  66.  
  67.     /**
  68.      * Get the JavaScript command for the button
  69.      *
  70.      * @param   object  $url  Button definition
  71.      *
  72.      * @return  string  JavaScript command string
  73.      *
  74.      * @since   3.0
  75.      */
  76.     protected function _getCommand($url)
  77.     {
  78.         return $url;
  79.     }
  80. }

Documentation generated on Tue, 19 Nov 2013 15:07:06 +0100 by phpDocumentor 1.4.3