View source
<?php
namespace Drupal\cms_content_sync\Plugin\cms_content_sync\field_handler;
use Drupal\cms_content_sync\Plugin\FieldHandlerBase;
use Drupal\Core\Field\FieldDefinitionInterface;
class DefaultFieldHandler extends FieldHandlerBase {
public static function supports($entity_type, $bundle, $field_name, FieldDefinitionInterface $field) {
$core_field_types = [
'boolean',
'changed',
'comment',
'created',
'daterange',
'datetime',
'decimal',
'email',
'float',
'iframe',
'integer',
'language',
'list_float',
'list_integer',
'list_string',
'map',
'range_decimal',
'range_float',
'range_integer',
'string',
'string_long',
'telephone',
'text',
'text_long',
'text_with_summary',
'timestamp',
'uri',
'uuid',
];
$contrib_field_types = [
'add_to_calendar_field',
'address',
'address_country',
'address_zone',
'block_field',
'color_field_type',
'easychart',
'geolocation',
'heading',
'key_value',
'key_value_long',
'metatag',
'social_media',
'soundcloud',
'tablefield',
'video_embed_field',
'viewfield',
'yearonly',
'yoast_seo',
'weight',
];
$allowed = array_merge($core_field_types, $contrib_field_types);
return false !== in_array($field
->getType(), $allowed) && ('menu_link_content' != $entity_type || 'parent' != $field_name);
}
}