class ExportManager in Content Synchronizer 3.x
Same name and namespace in other branches
- 8.2 src/Service/ExportManager.php \Drupal\content_synchronizer\Service\ExportManager
- 8 src/Service/ExportManager.php \Drupal\content_synchronizer\Service\ExportManager
The export manager.
Hierarchy
- class \Drupal\content_synchronizer\Service\ExportManager
Expanded class hierarchy of ExportManager
3 files declare their use of ExportManager
- content_synchronizer.module in ./
content_synchronizer.module - Hooks definitions for content_synchronizer module.
- ExportAction.php in src/
Plugin/ Action/ ExportAction.php - ExportConfirmForm.php in src/
Form/ ExportConfirmForm.php
1 string reference to 'ExportManager'
1 service uses ExportManager
File
- src/
Service/ ExportManager.php, line 11
Namespace
Drupal\content_synchronizer\ServiceView source
class ExportManager {
const SERVICE_NAME = 'content_synchronizer.export_manager';
/**
* Return the list of export checkboxes options.
*
* @return array
* The export list options.
*/
public function getExportsListOptions() {
$exportsOptions = [];
/** @var \Drupal\content_synchronizer\Entity\ExportEntity $export */
foreach (ExportEntity::loadMultiple() as $export) {
$exportsOptions[$export
->id()] = $export
->label();
}
return $exportsOptions;
}
/**
* Return the list of export for an entity.
*
* @param \Drupal\Core\Entity\EntityInterface $entity
* The entity.
*
* @return array
* THe list of exports.
*/
public function getEntitiesExport(EntityInterface $entity) {
if ($result = \Drupal::database()
->select(ExportEntity::TABLE_ITEMS)
->fields(ExportEntity::TABLE_ITEMS, [
ExportEntity::FIELD_EXPORT_ID,
])
->condition(ExportEntity::FIELD_ENTITY_ID, $entity
->id())
->condition(ExportEntity::FIELD_ENTITY_TYPE, $entity
->getEntityTypeId())
->execute()) {
return ExportEntity::loadMultiple($result
->fetchCol());
}
return [];
}
/**
* Action after delete entity.
*/
public function onEntityDelete(EntityInterface $entity) {
foreach ($this
->getEntitiesExport($entity) as $export) {
$export
->removeEntity($entity);
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ExportManager:: |
public | function | Return the list of export for an entity. | |
ExportManager:: |
public | function | Return the list of export checkboxes options. | |
ExportManager:: |
public | function | Action after delete entity. | |
ExportManager:: |
constant |