interface LocalLibraryInterface in Libraries API 8.3
Provides an interface for local libraries.
Local libraries are libraries that can be found on the filesystem. If the library files can be found in the filesystem a library is considered installed and its library path can be retrieved.
Because determining whether or not the library is available locally is not the responsibility of the library itself, but of a designated locator, this interface declares setter methods, as well.
Hierarchy
- interface \Drupal\libraries\ExternalLibrary\LibraryInterface
- interface \Drupal\libraries\ExternalLibrary\Local\LocalLibraryInterface
Expanded class hierarchy of LocalLibraryInterface
All classes that implement LocalLibraryInterface
See also
\Drupal\libraries\ExternalLibrary\Local\LocatorInterface
10 files declare their use of LocalLibraryInterface
- AssetLibrary.php in src/
ExternalLibrary/ Asset/ AssetLibrary.php - ChainLocator.php in src/
Plugin/ libraries/ Locator/ ChainLocator.php - GlobalLocator.php in src/
Plugin/ libraries/ Locator/ GlobalLocator.php - LibraryNotInstalledException.php in src/
ExternalLibrary/ Exception/ LibraryNotInstalledException.php - LibraryTypeBase.php in src/
ExternalLibrary/ Type/ LibraryTypeBase.php
File
- src/
ExternalLibrary/ Local/ LocalLibraryInterface.php, line 21
Namespace
Drupal\libraries\ExternalLibrary\LocalView source
interface LocalLibraryInterface extends LibraryInterface {
/**
* Checks whether the library is installed.
*
* @return bool
* TRUE if the library is installed; FALSE otherwise;
*/
public function isInstalled();
/**
* Marks the library as uninstalled.
*
* A corresponding method to mark the library as installed is not provided as
* an installed library should have a library path, so that
* LocalLibraryInterface::setLibraryPath() can be used instead.
*
* @return $this
*
* @see \Drupal\libraries\ExternalLibrary\Local\LocalLibraryInterface::isInstalled()
* @see \Drupal\libraries\ExternalLibrary\Local\LocalLibraryInterface::setLocalPath()
*/
public function setUninstalled();
/**
* Gets the local path to the library.
*
* @return string
* The absolute path to the library on the filesystem.
*
* @throws \Drupal\libraries\ExternalLibrary\Exception\LibraryNotInstalledException
*
* @see \Drupal\libraries\ExternalLibrary\Local\LocalLibraryInterface::setLocalPath()
*/
public function getLocalPath();
/**
* Sets the local path of the library.
*
* @param string $path
* The path to the library.
*
* @see \Drupal\libraries\ExternalLibrary\Local\LocalLibraryInterface::getLocalPath()
*/
public function setLocalPath($path);
/**
* Gets the locator of this library using the locator factory.
*
* Because determining the installation status and library path of a library
* is not specific to any library or even any library type, this logic is
* offloaded to separate locator objects.
*
* @param \Drupal\Component\Plugin\Factory\FactoryInterface $locator_factory
*
* @return \Drupal\libraries\ExternalLibrary\Local\LocatorInterface
*
* @see \Drupal\libraries\ExternalLibrary\Local\LocatorInterface
*/
public function getLocator(FactoryInterface $locator_factory);
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
LibraryInterface:: |
public static | function | Creates an instance of the library from its definition. | 1 |
LibraryInterface:: |
public | function | Returns the ID of the library. | |
LibraryInterface:: |
public | function | Returns the library type of the library. | 1 |
LocalLibraryInterface:: |
public | function | Gets the local path to the library. | |
LocalLibraryInterface:: |
public | function | Gets the locator of this library using the locator factory. | 3 |
LocalLibraryInterface:: |
public | function | Checks whether the library is installed. | |
LocalLibraryInterface:: |
public | function | Sets the local path of the library. | |
LocalLibraryInterface:: |
public | function | Marks the library as uninstalled. |