class LingotekFieldDeletedConfigSubscriber in Lingotek Translation 3.4.x
Same name and namespace in other branches
- 8.2 src/EventSubscriber/LingotekFieldDeletedConfigSubscriber.php \Drupal\lingotek\EventSubscriber\LingotekFieldDeletedConfigSubscriber
- 4.0.x src/EventSubscriber/LingotekFieldDeletedConfigSubscriber.php \Drupal\lingotek\EventSubscriber\LingotekFieldDeletedConfigSubscriber
- 3.0.x src/EventSubscriber/LingotekFieldDeletedConfigSubscriber.php \Drupal\lingotek\EventSubscriber\LingotekFieldDeletedConfigSubscriber
- 3.1.x src/EventSubscriber/LingotekFieldDeletedConfigSubscriber.php \Drupal\lingotek\EventSubscriber\LingotekFieldDeletedConfigSubscriber
- 3.2.x src/EventSubscriber/LingotekFieldDeletedConfigSubscriber.php \Drupal\lingotek\EventSubscriber\LingotekFieldDeletedConfigSubscriber
- 3.3.x src/EventSubscriber/LingotekFieldDeletedConfigSubscriber.php \Drupal\lingotek\EventSubscriber\LingotekFieldDeletedConfigSubscriber
- 3.5.x src/EventSubscriber/LingotekFieldDeletedConfigSubscriber.php \Drupal\lingotek\EventSubscriber\LingotekFieldDeletedConfigSubscriber
- 3.6.x src/EventSubscriber/LingotekFieldDeletedConfigSubscriber.php \Drupal\lingotek\EventSubscriber\LingotekFieldDeletedConfigSubscriber
- 3.7.x src/EventSubscriber/LingotekFieldDeletedConfigSubscriber.php \Drupal\lingotek\EventSubscriber\LingotekFieldDeletedConfigSubscriber
- 3.8.x src/EventSubscriber/LingotekFieldDeletedConfigSubscriber.php \Drupal\lingotek\EventSubscriber\LingotekFieldDeletedConfigSubscriber
Updates Lingotek config if a field is deleted.
Hierarchy
- class \Drupal\lingotek\EventSubscriber\LingotekFieldDeletedConfigSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
Expanded class hierarchy of LingotekFieldDeletedConfigSubscriber
1 string reference to 'LingotekFieldDeletedConfigSubscriber'
1 service uses LingotekFieldDeletedConfigSubscriber
File
- src/
EventSubscriber/ LingotekFieldDeletedConfigSubscriber.php, line 15
Namespace
Drupal\lingotek\EventSubscriberView source
class LingotekFieldDeletedConfigSubscriber implements EventSubscriberInterface {
/**
* The Lingotek configuration service.
*
* @var \Drupal\lingotek\LingotekConfigurationServiceInterface
*/
protected $lingotekConfiguration;
/**
* Constructs a LingotekFieldDeletedConfigSubscriber.
*
* @param \Drupal\lingotek\LingotekConfigurationServiceInterface $lingotek_configuration
* The Lingotek configuration service.
*/
public function __construct(LingotekConfigurationServiceInterface $lingotek_configuration) {
$this->lingotekConfiguration = $lingotek_configuration;
}
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
return [
ConfigEvents::DELETE => 'onConfigDelete',
];
}
/**
* Updates the Lingotek configuration when a field is deleted.
*
* @param \Drupal\Core\Config\ConfigCrudEvent $event
* The configuration event.
*/
public function onConfigDelete(ConfigCrudEvent $event) {
if (!InstallerKernel::installationAttempted()) {
$config = $event
->getConfig();
if ($config instanceof FieldConfigInterface) {
$field_name = $config
->getName();
$entity_type_id = $config
->getTargetEntityTypeId();
$bundle = $config
->getTargetBundle();
$this->lingotekConfiguration
->setFieldLingotekEnabled($entity_type_id, $bundle, $field_name, FALSE);
}
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
LingotekFieldDeletedConfigSubscriber:: |
protected | property | The Lingotek configuration service. | |
LingotekFieldDeletedConfigSubscriber:: |
public static | function | ||
LingotekFieldDeletedConfigSubscriber:: |
public | function | Updates the Lingotek configuration when a field is deleted. | |
LingotekFieldDeletedConfigSubscriber:: |
public | function | Constructs a LingotekFieldDeletedConfigSubscriber. |