[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/src/WebAsset/ -> WebAssetManagerInterface.php (source)

   1  <?php
   2  
   3  /**
   4   * Joomla! Content Management System
   5   *
   6   * @copyright  (C) 2019 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\WebAsset;
  11  
  12  use Joomla\CMS\WebAsset\Exception\InvalidActionException;
  13  use Joomla\CMS\WebAsset\Exception\UnknownAssetException;
  14  use Joomla\CMS\WebAsset\Exception\UnsatisfiedDependencyException;
  15  
  16  // phpcs:disable PSR1.Files.SideEffects
  17  \defined('JPATH_PLATFORM') or die;
  18  // phpcs:enable PSR1.Files.SideEffects
  19  
  20  /**
  21   * Web Asset Manager Interface
  22   *
  23   * @since  4.0.0
  24   */
  25  interface WebAssetManagerInterface
  26  {
  27      /**
  28       * Enable an asset item to be attached to a Document
  29       *
  30       * @param   string  $type  Asset type, script or style etc
  31       * @param   string  $name  The asset name
  32       *
  33       * @return self
  34       *
  35       * @throws  UnknownAssetException  When Asset cannot be found
  36       * @throws  InvalidActionException When the Manager already attached to a Document
  37       *
  38       * @since  4.0.0
  39       */
  40      public function useAsset(string $type, string $name): self;
  41  
  42      /**
  43       * Deactivate an asset item, so it will not be attached to a Document
  44       *
  45       * @param   string  $type  Asset type, script or style etc
  46       * @param   string  $name  The asset name
  47       *
  48       * @return self
  49       *
  50       * @throws  UnknownAssetException  When Asset cannot be found
  51       * @throws  InvalidActionException When the Manager already attached to a Document
  52       *
  53       * @since  4.0.0
  54       */
  55      public function disableAsset(string $type, string $name): self;
  56  
  57      /**
  58       * Check whether the asset are enabled
  59       *
  60       * @param   string  $type  Asset type, script or style etc
  61       * @param   string  $name  The asset name
  62       *
  63       * @return  boolean
  64       *
  65       * @throws  UnknownAssetException  When Asset cannot be found
  66       *
  67       * @since  4.0.0
  68       */
  69      public function isAssetActive(string $type, string $name): bool;
  70  
  71      /**
  72       * Get all assets that was enabled for given type
  73       *
  74       * @param   string  $type  Asset type, script or style etc
  75       * @param   bool    $sort  Whether need to sort the assets to follow the dependency Graph
  76       *
  77       * @return  WebAssetItemInterface[]
  78       *
  79       * @throws  UnknownAssetException  When Asset cannot be found
  80       * @throws  UnsatisfiedDependencyException When Dependency cannot be found
  81       *
  82       * @since  4.0.0
  83       */
  84      public function getAssets(string $type, bool $sort = false): array;
  85  }


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