Commit d27d90ce authored by alexpott's avatar alexpott
Browse files

Issue #2708509 by damiankloip, dawehner, amateescu: custom_storage does not...

Issue #2708509 by damiankloip, dawehner, amateescu: custom_storage does not work on field types with a storage schema already
parent 8e2cf9db
......@@ -185,7 +185,7 @@ public function getFieldTableName($field_name) {
public function getColumnNames($field_name) {
if (!isset($this->columnMapping[$field_name])) {
$this->columnMapping[$field_name] = array();
if (isset($this->fieldStorageDefinitions[$field_name])) {
if (isset($this->fieldStorageDefinitions[$field_name]) && !$this->fieldStorageDefinitions[$field_name]->hasCustomStorage()) {
foreach (array_keys($this->fieldStorageDefinitions[$field_name]->getColumns()) as $property_name) {
$this->columnMapping[$field_name][$property_name] = $this->getFieldColumnName($this->fieldStorageDefinitions[$field_name], $property_name);
}
......
......@@ -295,6 +295,12 @@ function views_field_default_views_data(FieldStorageConfigInterface $field_stora
if (!$field_storage->getBundles()) {
return $data;
}
// Ignore custom storage too.
if ($field_storage->hasCustomStorage()) {
return $data;
}
// Check whether the entity type storage is supported.
$storage = _views_field_get_entity_type_storage($field_storage);
if (!$storage) {
......
......@@ -218,6 +218,15 @@ public function testGetColumnNames() {
$table_mapping = new DefaultTableMapping($this->entityType, $definitions);
$expected = ['value' => 'test__value', 'format' => 'test__format'];
$this->assertSame($expected, $table_mapping->getColumnNames('test'));
$definitions['test'] = $this->setUpDefinition('test', ['value']);
// Set custom storage.
$definitions['test']->expects($this->any())
->method('hasCustomStorage')
->wilLReturn(TRUE);
$table_mapping = new DefaultTableMapping($this->entityType, $definitions);
// Should return empty for column names.
$this->assertSame([], $table_mapping->getColumnNames('test'));
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment