FieldTypeDefaults.php

Same filename in this branch
  1. main core/modules/field/src/Plugin/migrate/process/d7/FieldTypeDefaults.php
Same filename and directory in other branches
  1. 8.9.x core/modules/field/src/Plugin/migrate/process/FieldTypeDefaults.php
  2. 11.x core/modules/field/src/Plugin/migrate/process/d6/FieldTypeDefaults.php
  3. 11.x core/modules/field/src/Plugin/migrate/process/d7/FieldTypeDefaults.php
  4. 10 core/modules/field/src/Plugin/migrate/process/d6/FieldTypeDefaults.php
  5. 10 core/modules/field/src/Plugin/migrate/process/d7/FieldTypeDefaults.php
  6. 9 core/modules/field/src/Plugin/migrate/process/d6/FieldTypeDefaults.php
  7. 9 core/modules/field/src/Plugin/migrate/process/d7/FieldTypeDefaults.php
  8. 8.9.x core/modules/field/src/Plugin/migrate/process/d6/FieldTypeDefaults.php
  9. 8.9.x core/modules/field/src/Plugin/migrate/process/d7/FieldTypeDefaults.php

Namespace

Drupal\field\Plugin\migrate\process\d6

File

core/modules/field/src/Plugin/migrate/process/d6/FieldTypeDefaults.php

View source
<?php

namespace Drupal\field\Plugin\migrate\process\d6;

use Drupal\migrate\Attribute\MigrateProcess;
use Drupal\migrate\MigrateException;
use Drupal\migrate\ProcessPluginBase;
use Drupal\migrate\MigrateExecutableInterface;
use Drupal\migrate\Row;

/**
 * Gives us a chance to set per field defaults.
 *
 * @deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. There is no
 *   replacement.
 *
 * @see https://www.drupal.org/node/3533560
 */
class FieldTypeDefaults extends ProcessPluginBase {
  public function __construct(array $configuration, $plugin_id, $plugin_definition) {
    @trigger_error(__CLASS__ . ' is deprecated in drupal:11.3.0 and is removed from drupal:12.0.0. There is no replacement. See https://www.drupal.org/node/3533560', E_USER_DEPRECATED);
    parent::__construct($configuration, $plugin_id, $plugin_definition);
  }
  
  /**
   * {@inheritdoc}
   */
  public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
    if (is_array($value)) {
      if ($row->getSourceProperty('module') == 'date') {
        $value = 'datetime_default';
      }
      else {
        throw new MigrateException(sprintf('Failed to lookup field type %s in the static map.', var_export($value, TRUE)));
      }
    }
    return $value;
  }

}

Classes

Title Deprecated Summary
FieldTypeDefaults

in drupal:11.3.0 and is removed from drupal:12.0.0. There is no replacement.

Gives us a chance to set per field defaults.

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