You are here

public function SettingsForm::__construct in File metadata manager 8

Same name and namespace in other branches
  1. 8.2 src/Form/SettingsForm.php \Drupal\file_mdm\Form\SettingsForm::__construct()

Constructs a SettingsForm object.

Parameters

\Drupal\Core\Config\ConfigFactoryInterface $config_factory: The factory for configuration objects.

\Drupal\file_mdm\Plugin\FileMetadataPluginManager $manager: The file metadata plugin manager.

Overrides ConfigFormBase::__construct

File

src/Form/SettingsForm.php, line 32

Class

SettingsForm
Configures file_mdm settings for this site.

Namespace

Drupal\file_mdm\Form

Code

public function __construct(ConfigFactoryInterface $config_factory, FileMetadataPluginManager $manager) {
  parent::__construct($config_factory);
  foreach ($manager
    ->getDefinitions() as $id => $definition) {
    $this->metadataPlugins[$id] = $manager
      ->createInstance($id);
  }
  uasort($this->metadataPlugins, function ($a, $b) {
    return Unicode::strcasecmp((string) $a
      ->getPluginDefinition()['title'], (string) $b
      ->getPluginDefinition()['title']);
  });
}