'node', 'node_field_data' => 'node', 'node__body' => 'node', 'node_revision' => 'node', 'node_search_index' => NULL, 'node__field_name_0' => 'node', 'node__field_name_5' => 'node', 'node_counter' => NULL, 'history' => NULL, 'views' => NULL, 'forum_index' => NULL, 'comment' => 'comment', 'comment_field_data' => 'comment', 'comment__comment_body' => 'comment', 'comment_entity_statistics' => NULL, 'watchdog' => NULL, 'users' => 'user', 'users_field_data' => 'user', 'users_roles' => NULL, 'views_test_data' => NULL, 'taxonomy_term_data' => 'taxonomy_term', 'taxonomy_term_field_data' => 'taxonomy_term', 'taxonomy_index' => NULL, 'taxonomy_term__field_foo' => 'taxonomy_term', 'file_managed' => 'file', 'file_usage' => NULL, 'entity_test' => 'entity_test', 'aggregator_feed' => 'aggregator_feed', 'aggregator_item' => 'aggregator_item', ]; $field_map = [ 'node_field_data:nid' => 'nid', 'node_field_data:uid' => 'uid', 'node_field_data:title' => 'title', 'node_field_data:type' => 'type', 'node_field_data:status' => 'status', 'node_field_data:promote' => 'promote', 'node_field_data:sticky' => 'sticky', 'node_field_data:created' => 'created', 'node_field_data:changed' => 'changed', 'node_field_data:langcode' => 'langcode', 'node_field_data:uid_touch' => NULL, 'node_field_data:status_extra' => NULL, 'node_field_data:uid_revision' => 'uid_revision', 'node_field_data:created_year_month' => NULL, 'node_field_data:created_day' => NULL, 'node_field_data:created_fulldate' => NULL, 'node_field_data:created_month' => NULL, 'node__body:body_value' => 'body', 'node__body:body' => 'body', 'node__field_name_0:field_name_0' => 'field_name_0', 'node__field_name_5:field_name_5' => 'field_name_5', 'node:node_bulk_form' => NULL, 'node:status' => 'status', 'node:created' => 'created', 'node:sticky' => 'sticky', 'node:nid' => 'nid', 'node:delete' => NULL, 'node:node_listing_empty' => NULL, 'node_revision:nid' => 'nid', 'node_revision:vid' => 'vid', 'node:edit_node' => NULL, 'node:delete_node' => NULL, 'node:uid_touch_tracker' => NULL, 'node:path' => NULL, 'comment_field_data:subject' => 'subject', 'comment_field_data:status' => 'status', 'comment_field_data:changed' => 'changed', 'comment_field_data:created' => 'created', 'comment__comment_body:comment_body_value' => 'comment_body', 'comment:cid' => 'cid', 'users:uid' => 'uid', 'users:name' => 'name', 'users:contact' => NULL, 'users:data' => NULL, 'users:status' => 'status', 'users_field_data:name' => 'name', 'users_field_data:access' => 'access', 'users_field_data:mail' => 'mail', 'users_field_data:status' => 'status', 'users_field_data:created' => 'created', 'users_field_data:changed' => 'changed', 'users:user_bulk_form' => NULL, 'users:edit_node' => NULL, // is this right? 'users:uid_raw' => NULL, 'users:translation_link' => NULL, 'taxonomy_term_data:tid' => 'tid', 'taxonomy_term_data:name' => 'name', 'taxonomy_term_field_data:name' => 'name', 'taxonomy_term_field_data:tid' => 'tid', 'taxonomy_term__field_foo:field_foo_value' => 'field_foo', 'taxonomy_term_field_data:description__value' => 'description', 'entity_test:id' => 'id', 'file_managed:fid' => 'fid', 'file_managed:filemime' => 'filemime', 'file_managed:created' => 'created', 'file_managed:status' => 'status', 'file_managed:filesize' => 'filesize', 'file_managed:changed' => 'changed', 'file_managed:filename' => 'filename', 'aggregator_item:timestamp' => 'timestamp', 'aggregator_item:iid' => 'iid', 'aggregator_item:title' => 'title', 'aggregator_item:author' => 'author', 'aggregator_item:description' => 'description', 'aggregator_feed:fid' => 'fid', 'aggregator_feed:link' => 'link', 'aggregator_feed:modified' => 'modified', 'aggregator_feed:title' => 'title', 'aggregator_feed:description' => 'description', 'aggregator_feed:url' => 'url', 'entity_test:name' => 'name', ]; foreach ($filenames as $filename) { $content = file_get_contents($filename); $config = Yaml::decode($content); convert_single_config($filename, $config, $table_entity_map, $field_map); } function convert_single_config($filename, array &$config, array $table_entity_map, array $field_map) { foreach ($config['display'] as $display_id => &$display) { $handler_types = ['fields', 'filters', 'arguments', 'sorts', 'header', 'footer', 'empty']; foreach ($handler_types as $handler_type) { if (isset($display['display_options'][$handler_type])) { foreach ($display['display_options'][$handler_type] as $id => &$field) { if (isset($table_entity_map[$field['table']]) || array_key_exists($field['table'], $table_entity_map)) { if ($table_entity_map[$field['table']]) { $field['entity_type'] = $table_entity_map[$field['table']]; } else { // There is no proper table, lets' continue. continue; } } else { // We don't know the table, let's continue. continue; } $table_field = $field['table'] . ':' . $field['field']; if (isset($field_map[$table_field]) || array_key_exists($table_field, $field_map)) { if ($field_map[$table_field]) { $field['entity_field'] = $field_map[$table_field]; } } else { print_r($filename); print_r(":"); print_r($field['table']); print_r(":"); print_r($field['field']); print_r(" "); } } } } } file_put_contents($filename, Yaml::encode($config)); }