Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
229
Merge Requests
229
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
f30b7257
Commit
f30b7257
authored
Jul 16, 2015
by
alexpott
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue
#2529144
by phenaproxima: Create cckfield plugin for text fields
parent
df44c00a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
72 additions
and
53 deletions
+72
-53
core/modules/migrate_drupal/migration_templates/d6_field_formatter_settings.yml
...rupal/migration_templates/d6_field_formatter_settings.yml
+0
-4
core/modules/migrate_drupal/migration_templates/d6_field_instance_widget_settings.yml
...migration_templates/d6_field_instance_widget_settings.yml
+0
-1
core/modules/migrate_drupal/src/Plugin/migrate/cckfield/TextField.php
.../migrate_drupal/src/Plugin/migrate/cckfield/TextField.php
+71
-0
core/modules/migrate_drupal/src/Plugin/migrate/load/LoadEntity.php
...les/migrate_drupal/src/Plugin/migrate/load/LoadEntity.php
+1
-48
No files found.
core/modules/migrate_drupal/migration_templates/d6_field_formatter_settings.yml
View file @
f30b7257
...
...
@@ -52,10 +52,6 @@ process:
-
type
-
'
display_settings/format'
map
:
text
:
default
:
text_default
trimmed
:
text_trimmed
plain
:
basic_string
number_integer
:
default
:
number_integer
us_0
:
number_integer
...
...
core/modules/migrate_drupal/migration_templates/d6_field_instance_widget_settings.yml
View file @
f30b7257
...
...
@@ -36,7 +36,6 @@ process:
bypass
:
true
source
:
widget_type
map
:
text_textfield
:
text_textfield
number
:
number
email_textfield
:
email_default
date_select
:
datetime_default
...
...
core/modules/migrate_drupal/src/Plugin/migrate/cckfield/TextField.php
0 → 100644
View file @
f30b7257
<?php
/**
* @file
* Contains \Drupal\migrate_drupal\Plugin\migrate\cckfield\TextField.
*/
namespace
Drupal\migrate_drupal\Plugin\migrate\cckfield
;
use
Drupal\migrate\Entity\MigrationInterface
;
/**
* @PluginID("text")
*/
class
TextField
extends
CckFieldPluginBase
{
/**
* {@inheritdoc}
*/
public
function
getFieldWidgetMap
()
{
return
[
'text_textfield'
=>
'text_textfield'
,
];
}
/**
* {@inheritdoc}
*/
public
function
getFieldFormatterMap
()
{
return
[
'default'
=>
'text_default'
,
'trimmed'
=>
'text_trimmed'
,
'plain'
=>
'basic_string'
,
];
}
/**
* {@inheritdoc}
*/
public
function
processCckFieldValues
(
MigrationInterface
$migration
,
$field_name
,
$data
)
{
// The data is stored differently depending on whether we're using
// db storage.
$value_key
=
$data
[
'db_storage'
]
?
$field_name
:
"
$field_name
/value"
;
$format_key
=
$data
[
'db_storage'
]
?
$field_name
.
'_format'
:
"
$field_name
/format"
;
$migration
->
setProcessOfProperty
(
"
$field_name
/value"
,
$value_key
);
// See \Drupal\migrate_drupal\Plugin\migrate\source\d6\User::baseFields(),
// signature_format for an example of the YAML that represents this
// process array.
$process
=
[
[
'plugin'
=>
'static_map'
,
'bypass'
=>
TRUE
,
'source'
=>
$format_key
,
'map'
=>
[
0
=>
NULL
]
],
[
'plugin'
=>
'skip_on_empty'
,
'method'
=>
'process'
,
],
[
'plugin'
=>
'migration'
,
'migration'
=>
'd6_filter_format'
,
'source'
=>
$format_key
,
],
];
$migration
->
mergeProcessOfProperty
(
"
$field_name
/format"
,
$process
);
}
}
core/modules/migrate_drupal/src/Plugin/migrate/load/LoadEntity.php
View file @
f30b7257
...
...
@@ -87,13 +87,7 @@ public function loadMultiple(EntityStorageInterface $storage, array $sub_ids = N
if
(
$source_plugin
instanceof
CckFieldMigrateSourceInterface
)
{
foreach
(
$source_plugin
->
fieldData
()
as
$field_name
=>
$data
)
{
switch
(
$data
[
'type'
])
{
case
'text'
:
$this
->
processTextField
(
$field_name
,
$data
,
$migration
);
break
;
default
:
$migration
->
setProcessOfProperty
(
$field_name
,
$field_name
);
}
$migration
->
setProcessOfProperty
(
$field_name
,
$field_name
);
}
}
else
{
...
...
@@ -110,45 +104,4 @@ public function loadMultiple(EntityStorageInterface $storage, array $sub_ids = N
return
$migrations
;
}
/**
* Manipulate text fields with any per field type processing.
*
* @param string $field_name
* The field we're processing.
* @param array $field_data
* The an array of field type data from the source.
* @param \Drupal\migrate\Entity\MigrationInterface $migration
* The migration entity.
*/
protected
function
processTextField
(
$field_name
,
$field_data
,
MigrationInterface
$migration
)
{
// The data is stored differently depending on whether we're using
// db storage.
$value_key
=
$field_data
[
'db_storage'
]
?
$field_name
:
"
$field_name
/value"
;
$format_key
=
$field_data
[
'db_storage'
]
?
$field_name
.
'_format'
:
"
$field_name
/format"
;
$migration
->
setProcessOfProperty
(
"
$field_name
/value"
,
$value_key
);
// See \Drupal\migrate_drupal\Plugin\migrate\source\d6\User::baseFields(),
// signature_format for an example of the YAML that represents this
// process array.
$process
=
[
[
'plugin'
=>
'static_map'
,
'bypass'
=>
TRUE
,
'source'
=>
$format_key
,
'map'
=>
[
0
=>
NULL
]
],
[
'plugin'
=>
'skip_on_empty'
,
'method'
=>
'process'
,
],
[
'plugin'
=>
'migration'
,
'migration'
=>
'd6_filter_format'
,
'source'
=>
$format_key
,
],
];
$migration
->
mergeProcessOfProperty
(
"
$field_name
/format"
,
$process
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment