LinkField.php

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

Namespace

Drupal\link\Plugin\migrate\field\d7

File

core/modules/link/src/Plugin/migrate/field/d7/LinkField.php

View source
<?php

namespace Drupal\link\Plugin\migrate\field\d7;

use Drupal\link\Plugin\migrate\field\d6\LinkField as D6LinkField;
use Drupal\migrate\Plugin\MigrationInterface;

/**
 * @MigrateField(
 *   id = "link_field",
 *   core = {7},
 *   type_map = {
 *     "link_field" = "link"
 *   },
 *   source_module = "link",
 *   destination_module = "link"
 * )
 *
 * This plugin provides the exact same functionality as the Drupal 6 "link"
 * plugin with the exception that the plugin ID "link_field" is used in the
 * field type map.
 */
class LinkField extends D6LinkField {
    
    /**
     * {@inheritdoc}
     */
    public function getFieldFormatterMap() {
        return [
            'link_default' => 'link',
            'link_title_plain' => 'link',
            'link_host' => 'link',
            'link_url' => 'link',
            'link_plain' => 'link',
            'link_absolute' => 'link',
            'link_domain' => 'link',
            'link_no_protocol' => 'link',
            'link_short' => 'link',
            'link_label' => 'link',
            'link_separate' => 'link_separate',
        ];
    }
    
    /**
     * {@inheritdoc}
     */
    public function getFieldWidgetMap() {
        // By default, use the plugin ID for the widget types.
        return [
            'link_field' => 'link_default',
        ];
    }
    
    /**
     * {@inheritdoc}
     */
    public function alterFieldInstanceMigration(MigrationInterface $migration) {
        $process = [
            'plugin' => 'static_map',
            'source' => 'settings/title',
            'bypass' => TRUE,
            'map' => [
                'disabled' => DRUPAL_DISABLED,
                'optional' => DRUPAL_OPTIONAL,
                'required' => DRUPAL_REQUIRED,
            ],
        ];
        $migration->mergeProcessOfProperty('settings/title', $process);
    }

}

Classes

Title Deprecated Summary
LinkField @MigrateField( id = "link_field", core = {7}, type_map = { "link_field" = "link" }, source_module = "link", destination_module = "link" )

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