PageRenderTime 54ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/libraries/joomla/html/toolbar/button/link.php

https://github.com/joebushi/joomla
PHP | 69 lines | 26 code | 7 blank | 36 comment | 0 complexity | 1149df773438fb0b1c980747fbf0ee30 MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0
  1. <?php
  2. /**
  3. * @version $Id$
  4. * @package Joomla.Framework
  5. * @subpackage HTML
  6. * @copyright Copyright (C) 2005 - 2010 Open Source Matters, Inc. All rights reserved.
  7. * @license GNU General Public License version 2 or later; see LICENSE.txt
  8. */
  9. // No direct access
  10. defined('JPATH_BASE') or die;
  11. /**
  12. * Renders a link button
  13. *
  14. * @package Joomla.Framework
  15. * @subpackage HTML
  16. * @since 1.5
  17. */
  18. class JButtonLink extends JButton
  19. {
  20. /**
  21. * Button type
  22. *
  23. * @access protected
  24. * @var string
  25. */
  26. protected $_name = 'Link';
  27. public function fetchButton($type='Link', $name = 'back', $text = '', $url = null)
  28. {
  29. $text = JText::_($text);
  30. $class = $this->fetchIconClass($name);
  31. $doTask = $this->_getCommand($url);
  32. $html = "<a href=\"$doTask\">\n";
  33. $html .= "<span class=\"$class\">\n";
  34. $html .= "</span>\n";
  35. $html .= "$text\n";
  36. $html .= "</a>\n";
  37. return $html;
  38. }
  39. /**
  40. * Get the button CSS Id
  41. *
  42. * @access public
  43. * @return string Button CSS Id
  44. * @since 1.5
  45. */
  46. public function fetchId($name)
  47. {
  48. return $this->_parent->getName().'-'.$name;
  49. }
  50. /**
  51. * Get the JavaScript command for the button
  52. *
  53. * @access private
  54. * @param object $definition Button definition
  55. * @return string JavaScript command string
  56. * @since 1.5
  57. */
  58. protected function _getCommand($url)
  59. {
  60. return $url;
  61. }
  62. }