forked from Islandora/islandora_mirador
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMiradorImageTools.php
More file actions
76 lines (68 loc) · 2.36 KB
/
Copy pathMiradorImageTools.php
File metadata and controls
76 lines (68 loc) · 2.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
namespace Drupal\islandora_mirador\Plugin\IslandoraMiradorPlugin;
use Drupal\islandora_mirador\IslandoraMiradorPluginPluginBase;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Plugin implementation of the islandora_mirador.
*
* @IslandoraMiradorPlugin(
* id = "miradorImageToolsPlugin",
* label = @Translation("Mirador Image Tools"),
* description = @Translation("MIrador image manipluation..")
* )
*/
class MiradorImageTools extends IslandoraMiradorPluginPluginBase implements ContainerFactoryPluginInterface {
/**
* The config factory.
*
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
protected $configFactory;
/**
* Constructs a TextOverlay object.
*
* @param array $configuration
* A configuration array containing information about the plugin instance.
* @param string $plugin_id
* The plugin_id for the plugin instance.
* @param mixed $plugin_definition
* The plugin implementation definition.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory.
*/
public function __construct(array $configuration, $plugin_id, $plugin_definition, ConfigFactoryInterface $config_factory) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->configFactory = $config_factory;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static(
$configuration,
$plugin_id,
$plugin_definition,
$container->get('config.factory')
);
}
/**
* {@inheritdoc}
*/
public function windowConfigAlter(array &$windowConfig) {
// Get the config to check if this plugin is enabled.
$config = $this->configFactory->get('islandora_mirador.settings');
$enabled_plugins = $config->get('mirador_enabled_plugins');
if (!empty($enabled_plugins['miradorImageToolsPlugin'])) {
// Enabled config - checkbox is checked.
$windowConfig['imageToolsEnabled'] = TRUE;
$windowConfig['imageToolsOpen'] = TRUE;
}
else {
// Disabled config - checkbox is unchecked.
$windowConfig['imageToolsEnabled'] = FALSE;
$windowConfig['imageToolsOpen'] = FALSE;
}
}
}