[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/src/Toolbar/Button/ -> LinkButton.php (source)

   1  <?php
   2  
   3  /**
   4   * Joomla! Content Management System
   5   *
   6   * @copyright  (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
   7   * @license    GNU General Public License version 2 or later; see LICENSE.txt
   8   */
   9  
  10  namespace Joomla\CMS\Toolbar\Button;
  11  
  12  use Joomla\CMS\Toolbar\ToolbarButton;
  13  
  14  // phpcs:disable PSR1.Files.SideEffects
  15  \defined('JPATH_PLATFORM') or die;
  16  // phpcs:enable PSR1.Files.SideEffects
  17  
  18  /**
  19   * Renders a link button
  20   *
  21   * @method self    url(string $value)
  22   * @method self    target(string $value)
  23   * @method string  getUrl()
  24   * @method string  getTarget()
  25   *
  26   * @since  3.0
  27   */
  28  class LinkButton extends ToolbarButton
  29  {
  30      /**
  31       * Property layout.
  32       *
  33       * @var  string
  34       *
  35       * @since  4.0.0
  36       */
  37      protected $layout = 'joomla.toolbar.link';
  38  
  39      /**
  40       * Prepare options for this button.
  41       *
  42       * @param   array  $options  The options about this button.
  43       *
  44       * @return  void
  45       *
  46       * @since  4.0.0
  47       */
  48      protected function prepareOptions(array &$options)
  49      {
  50          parent::prepareOptions($options);
  51  
  52          unset($options['attributes']['type']);
  53      }
  54  
  55      /**
  56       * Fetch the HTML for the button
  57       *
  58       * @param   string  $type  Unused string.
  59       * @param   string  $name  Name to be used as apart of the id
  60       * @param   string  $text  Button text
  61       * @param   string  $url   The link url
  62       *
  63       * @return  string  HTML string for the button
  64       *
  65       * @since   3.0
  66       *
  67       * @deprecated  5.0 Use render() instead.
  68       */
  69      public function fetchButton($type = 'Link', $name = 'back', $text = '', $url = null)
  70      {
  71          $this->name($name)
  72              ->text($text)
  73              ->url($url);
  74  
  75          return $this->renderButton($this->options);
  76      }
  77  
  78      /**
  79       * Method to configure available option accessors.
  80       *
  81       * @return  array
  82       *
  83       * @since  4.0.0
  84       */
  85      protected static function getAccessors(): array
  86      {
  87          return array_merge(
  88              parent::getAccessors(),
  89              [
  90                  'url',
  91                  'target'
  92              ]
  93          );
  94      }
  95  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer