[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/src/Toolbar/Button/ -> CustomButton.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 custom button
  20   *
  21   * @method self html(string $value)
  22   * @method string getHtml()
  23   *
  24   * @since  3.0
  25   */
  26  class CustomButton extends ToolbarButton
  27  {
  28      /**
  29       * Render button HTML.
  30       *
  31       * @param   array  $options  The button options.
  32       *
  33       * @return  string  The button HTML.
  34       *
  35       * @since  4.0.0
  36       */
  37      protected function renderButton(array &$options): string
  38      {
  39          return (string) ($options['html'] ?? '');
  40      }
  41  
  42      /**
  43       * Fetch the HTML for the button
  44       *
  45       * @param   string  $type  Button type, unused string.
  46       * @param   string  $html  HTML string for the button
  47       * @param   string  $id    CSS id for the button
  48       *
  49       * @return  string   HTML string for the button
  50       *
  51       * @since   3.0
  52       *
  53       * @deprecated  5.0 Use render() instead.
  54       */
  55      public function fetchButton($type = 'Custom', $html = '', $id = 'custom')
  56      {
  57          return $html;
  58      }
  59  
  60      /**
  61       * Method to configure available option accessors.
  62       *
  63       * @return  array
  64       *
  65       * @since  4.0.0
  66       */
  67      protected static function getAccessors(): array
  68      {
  69          return array_merge(
  70              parent::getAccessors(),
  71              [
  72                  'html',
  73              ]
  74          );
  75      }
  76  }


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