DefaultContentEntityHandler.php in CMS Content Sync 8
File
src/Plugin/cms_content_sync/entity_handler/DefaultContentEntityHandler.php
View source
<?php
namespace Drupal\cms_content_sync\Plugin\cms_content_sync\entity_handler;
use Drupal\cms_content_sync\Plugin\EntityHandlerBase;
class DefaultContentEntityHandler extends EntityHandlerBase {
public static function supports($entity_type, $bundle) {
$entity_types = [
'block_content',
'config_pages',
'paragraph',
'paragraphs_library_item',
'bibcite_contributor',
'bibcite_reference',
'bibcite_keyword',
'redirect',
];
$moduleHandler = \Drupal::service('module_handler');
$eck_exists = $moduleHandler
->moduleExists('eck');
if ($eck_exists) {
$eck_entity_type = \Drupal::entityTypeManager()
->getStorage('eck_entity_type')
->load($entity_type);
if (!empty($eck_entity_type)) {
return true;
}
}
return in_array($entity_type, $entity_types);
}
public function getAllowedPreviewOptions() {
return [
'table' => 'Table',
'preview_mode' => 'Preview mode',
];
}
public function getForbiddenFields() {
return array_merge(parent::getForbiddenFields(), [
'parent_id',
]);
}
protected function hasLabelProperty() {
$moduleHandler = \Drupal::service('module_handler');
$eck_exists = $moduleHandler
->moduleExists('eck');
if ($eck_exists) {
$entity_type = \Drupal::entityTypeManager()
->getStorage('eck_entity_type')
->load($this->entityTypeName);
if ($entity_type) {
return $entity_type
->hasTitleField();
}
}
return true;
}
}