[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/src/Button/ -> TransitionButton.php (source)

   1  <?php
   2  
   3  /**
   4   * Joomla! Content Management System
   5   *
   6   * @copyright  (C) 2020 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\Button;
  11  
  12  use Joomla\CMS\Language\Text;
  13  
  14  // phpcs:disable PSR1.Files.SideEffects
  15  \defined('_JEXEC') or die;
  16  // phpcs:enable PSR1.Files.SideEffects
  17  
  18  /**
  19   * The PublishedButton class.
  20   *
  21   * @since  4.0.0
  22   */
  23  class TransitionButton extends ActionButton
  24  {
  25      /**
  26       * The layout path to render.
  27       *
  28       * @var  string
  29       *
  30       * @since  4.0.0
  31       */
  32      protected $layout = 'joomla.button.transition-button';
  33  
  34      /**
  35       * ActionButton constructor.
  36       *
  37       * @param   array  $options  The options for all buttons in this group.
  38       *
  39       * @since   4.0.0
  40       */
  41      public function __construct(array $options = [])
  42      {
  43          parent::__construct($options);
  44  
  45          $this->unknownState['icon'] = 'shuffle';
  46          $this->unknownState['title'] = $options['title'] ?? Text::_('JLIB_HTML_UNKNOWN_STATE');
  47          $this->unknownState['tip_content'] = $options['tip_content'] ?? $this->unknownState['title'];
  48      }
  49  
  50      /**
  51       * Render action button by item value.
  52       *
  53       * @param   integer|null  $value        Current value of this item.
  54       * @param   integer|null  $row          The row number of this item.
  55       * @param   array         $options      The options to override group options.
  56       *
  57       * @return  string  Rendered HTML.
  58       *
  59       * @since  4.0.0
  60       */
  61      public function render(?int $value = null, ?int $row = null, array $options = []): string
  62      {
  63          $default  = $this->unknownState;
  64  
  65          $options['tip_title'] = $options['tip_title'] ?? ($options['title'] ?? $default['title']);
  66  
  67          return parent::render($value, $row, $options);
  68      }
  69  }


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