TestExtractorWithFinder.php

Namespace

Drupal\icon_test\Plugin\IconExtractor

File

core/modules/system/tests/modules/icon_test/src/Plugin/IconExtractor/TestExtractorWithFinder.php

View source
<?php

declare (strict_types=1);
namespace Drupal\icon_test\Plugin\IconExtractor;

use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\Core\Theme\Icon\Attribute\IconExtractor;
use Drupal\Core\Theme\Icon\IconExtractorWithFinder;
use Drupal\Core\Theme\Icon\IconPackExtractorForm;

/**
 * Test plugin implementation of the icon_extractor.
 */
class TestExtractorWithFinder extends IconExtractorWithFinder {
  
  /**
   * {@inheritdoc}
   */
  public function discoverIcons() : array {
    $files = $this->getFilesFromSources();
    $icons = [];
    foreach ($files as $file) {
      if (!isset($file['icon_id'])) {
        continue;
      }
      $icons[] = $this->createIcon($file['icon_id'], $file['source'], $file['group'] ?? NULL);
    }
    return $icons;
  }

}

Classes

Title Deprecated Summary
TestExtractorWithFinder Test plugin implementation of the icon_extractor.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.