class SimpleInstagramFeedLibrary in Simple Instagram Feed Block 8.3
Implements Simple Instagram Feed Library service.
Hierarchy
- class \Drupal\simple_instagram_feed\Services\SimpleInstagramFeedLibrary implements SimpleInstagramFeedLibraryInterface uses MessengerTrait, StringTranslationTrait
Expanded class hierarchy of SimpleInstagramFeedLibrary
1 string reference to 'SimpleInstagramFeedLibrary'
1 service uses SimpleInstagramFeedLibrary
File
- src/
Services/ SimpleInstagramFeedLibrary.php, line 11
Namespace
Drupal\simple_instagram_feed\ServicesView source
class SimpleInstagramFeedLibrary implements SimpleInstagramFeedLibraryInterface {
use MessengerTrait;
use StringTranslationTrait;
/**
* The drupal root path.
*
* @var string
*/
private $root;
/**
* {@inheritdoc}
*/
public function isAvailable(bool $warning = FALSE) {
if (!file_exists($this->root . $this
->getPath())) {
if ($warning) {
$this
->messenger()
->addWarning($this
->getWarningMessage());
}
return FALSE;
}
return TRUE;
}
/**
* {@inheritdoc}
*/
public function getWarningMessage() {
return $this
->t('Missing library: The <a href=":url">jquery.instagramFeed</a> library should be installed at <strong>:path</strong>.', [
':url' => 'https://github.com/jsanahuja/jquery.instagramFeed',
':path' => $this
->getPath(),
]);
}
/**
* Returns the expected js library path.
*/
private function getPath() {
return '/libraries/jqueryinstagramfeed/jquery.instagramFeed.min.js';
}
/**
* {@inheritdoc}
*/
public function __construct($root) {
$this->root = $root;
}
/**
* {@inheritdoc}
*/
public function create(ContainerInterface $container) {
return new static($container
->get('app.root'));
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MessengerTrait:: |
protected | property | The messenger. | 29 |
MessengerTrait:: |
public | function | Gets the messenger. | 29 |
MessengerTrait:: |
public | function | Sets the messenger. | |
SimpleInstagramFeedLibrary:: |
private | property | The drupal root path. | |
SimpleInstagramFeedLibrary:: |
public | function | ||
SimpleInstagramFeedLibrary:: |
private | function | Returns the expected js library path. | |
SimpleInstagramFeedLibrary:: |
public | function |
Get the warning message. Overrides SimpleInstagramFeedLibraryInterface:: |
|
SimpleInstagramFeedLibrary:: |
public | function |
Check library avalilability. Overrides SimpleInstagramFeedLibraryInterface:: |
|
SimpleInstagramFeedLibrary:: |
public | function | ||
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |