3 namespace Drupal\libraries\ExternalLibrary\Local;
5 use Drupal\Component\Plugin\Factory\FactoryInterface;
6 use Drupal\libraries\ExternalLibrary\LibraryInterface;
9 * Provides an interface for local libraries.
11 * Local libraries are libraries that can be found on the filesystem. If the
12 * library files can be found in the filesystem a library is considered
13 * installed and its library path can be retrieved.
15 * Because determining whether or not the library is available locally is not
16 * the responsibility of the library itself, but of a designated locator, this
17 * interface declares setter methods, as well.
19 * @see \Drupal\libraries\ExternalLibrary\Local\LocatorInterface
21 interface LocalLibraryInterface extends LibraryInterface {
24 * Checks whether the library is installed.
27 * TRUE if the library is installed; FALSE otherwise;
29 public function isInstalled();
32 * Marks the library as uninstalled.
34 * A corresponding method to mark the library as installed is not provided as
35 * an installed library should have a library path, so that
36 * LocalLibraryInterface::setLibraryPath() can be used instead.
40 * @see \Drupal\libraries\ExternalLibrary\Local\LocalLibraryInterface::isInstalled()
41 * @see \Drupal\libraries\ExternalLibrary\Local\LocalLibraryInterface::setLocalPath()
43 public function setUninstalled();
46 * Gets the local path to the library.
49 * The absolute path to the library on the filesystem.
51 * @throws \Drupal\libraries\ExternalLibrary\Exception\LibraryNotInstalledException
53 * @see \Drupal\libraries\ExternalLibrary\Local\LocalLibraryInterface::setLocalPath()
55 public function getLocalPath();
58 * Sets the local path of the library.
61 * The path to the library.
63 * @see \Drupal\libraries\ExternalLibrary\Local\LocalLibraryInterface::getLocalPath()
65 public function setLocalPath($path);
68 * Gets the locator of this library using the locator factory.
70 * Because determining the installation status and library path of a library
71 * is not specific to any library or even any library type, this logic is
72 * offloaded to separate locator objects.
74 * @param \Drupal\Component\Plugin\Factory\FactoryInterface $locator_factory
76 * @return \Drupal\libraries\ExternalLibrary\Local\LocatorInterface
78 * @see \Drupal\libraries\ExternalLibrary\Local\LocatorInterface
80 public function getLocator(FactoryInterface $locator_factory);