FileField.php

Same filename in this branch
  1. 8.9.x core/modules/file/src/Plugin/migrate/field/d6/FileField.php
  2. 8.9.x core/modules/file/src/Plugin/migrate/field/d7/FileField.php
  3. 8.9.x core/modules/file/src/Plugin/migrate/cckfield/d6/FileField.php
Same filename in other branches
  1. 9 core/modules/file/src/Plugin/migrate/field/d6/FileField.php
  2. 9 core/modules/file/src/Plugin/migrate/field/d7/FileField.php
  3. 10 core/modules/file/src/Plugin/migrate/field/d6/FileField.php
  4. 10 core/modules/file/src/Plugin/migrate/field/d7/FileField.php
  5. 11.x core/modules/file/src/Plugin/migrate/field/d6/FileField.php
  6. 11.x core/modules/file/src/Plugin/migrate/field/d7/FileField.php

Namespace

Drupal\file\Plugin\migrate\cckfield\d7

File

core/modules/file/src/Plugin/migrate/cckfield/d7/FileField.php

View source
<?php

namespace Drupal\file\Plugin\migrate\cckfield\d7;

@trigger_error('FileField is deprecated in Drupal 8.3.x and will be removed before Drupal 9.0.x. Use \\Drupal\\file\\Plugin\\migrate\\field\\d7\\FileField instead.', E_USER_DEPRECATED);
use Drupal\migrate\Plugin\MigrationInterface;
use Drupal\migrate\Row;
use Drupal\migrate_drupal\Plugin\migrate\cckfield\CckFieldPluginBase;

/**
 * @MigrateCckField(
 *   id = "file",
 *   core = {7},
 *   source_module = "file",
 *   destination_module = "file"
 * )
 *
 * @deprecated in drupal:8.3.0 and is removed from drupal:9.0.0. Use
 * \Drupal\file\Plugin\migrate\field\d7\FileField instead.
 *
 * @see https://www.drupal.org/node/2751897
 */
class FileField extends CckFieldPluginBase {
    
    /**
     * {@inheritdoc}
     */
    public function getFieldWidgetMap() {
        return [
            'filefield_widget' => 'file_generic',
        ];
    }
    
    /**
     * {@inheritdoc}
     */
    public function getFieldFormatterMap() {
        return [
            'default' => 'file_default',
            'url_plain' => 'file_url_plain',
            'path_plain' => 'file_url_plain',
            'image_plain' => 'image',
            'image_nodelink' => 'image',
            'image_imagelink' => 'image',
        ];
    }
    
    /**
     * {@inheritdoc}
     */
    public function processCckFieldValues(MigrationInterface $migration, $field_name, $data) {
        $process = [
            'plugin' => 'sub_process',
            'source' => $field_name,
            'process' => [
                'target_id' => 'fid',
                'display' => 'display',
                'description' => 'description',
            ],
        ];
        $migration->mergeProcessOfProperty($field_name, $process);
    }
    
    /**
     * {@inheritdoc}
     */
    public function getFieldType(Row $row) {
        return $row->getSourceProperty('widget_type') == 'imagefield_widget' ? 'image' : 'file';
    }

}

Classes

Title Deprecated Summary
FileField

in drupal:8.3.0 and is removed from drupal:9.0.0. Use \Drupal\file\Plugin\migrate\field\d7\FileField instead.

Plugin annotation @MigrateCckField( id = "file", core = {7}, source_module = "file", destination_module = "file" )

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.