You are here

protected function Dropdown::getList in Image Effects 8

Same name in this branch
  1. 8 src/Plugin/image_effects/FontSelector/Dropdown.php \Drupal\image_effects\Plugin\image_effects\FontSelector\Dropdown::getList()
  2. 8 src/Plugin/image_effects/ImageSelector/Dropdown.php \Drupal\image_effects\Plugin\image_effects\ImageSelector\Dropdown::getList()
Same name and namespace in other branches
  1. 8.3 src/Plugin/image_effects/ImageSelector/Dropdown.php \Drupal\image_effects\Plugin\image_effects\ImageSelector\Dropdown::getList()
  2. 8.2 src/Plugin/image_effects/ImageSelector/Dropdown.php \Drupal\image_effects\Plugin\image_effects\ImageSelector\Dropdown::getList()

Returns an array of files with image extensions in the specified directory.

Return value

array Array of image files.

1 call to Dropdown::getList()
Dropdown::selectionElement in src/Plugin/image_effects/ImageSelector/Dropdown.php
Return a form element to select the plugin content.

File

src/Plugin/image_effects/ImageSelector/Dropdown.php, line 148

Class

Dropdown
Dropdown image selector plugin.

Namespace

Drupal\image_effects\Plugin\image_effects\ImageSelector

Code

protected function getList() {
  $filelist = [];
  if (is_dir($this->configuration['path']) && ($handle = opendir($this->configuration['path']))) {
    while ($file = readdir($handle)) {
      $extension = pathinfo($file, PATHINFO_EXTENSION);
      if (in_array($extension, $this->imageFactory
        ->getSupportedExtensions())) {
        $filelist[] = $file;
      }
    }
    closedir($handle);
  }
  return $filelist;
}