You are here

public function LazyFilter::setConfiguration in Lazy-load 8.3

Sets the configuration for this plugin instance.

Parameters

array $configuration: An associative array containing the plugin's configuration.

Overrides FilterBase::setConfiguration

File

src/Plugin/Filter/LazyFilter.php, line 104

Class

LazyFilter
Provides a filter to lazy-load images.

Namespace

Drupal\lazy\Plugin\Filter

Code

public function setConfiguration(array $configuration) {
  parent::setConfiguration($configuration);
  if ($configuration['status'] && !empty($configuration['settings']) && $configuration['settings']['image'] == FALSE && $configuration['settings']['iframe'] == FALSE) {
    $this->status = FALSE;
    $this
      ->messenger()
      ->addWarning($this
      ->t('Lazy-loading is not enabled. The filter configuration needs to be enabled for either of the IMG or IFRAME tags.'));
  }
  return $this;
}