You are here

public function DrupalFieldablePanelsPanesMigration::__construct in Fieldable Panels Panes (FPP) 7

Required arguments:

source_connection - Connection key for the DatabaseConnection holding the source Drupal installation. source_version - Major version number (as an integer) of the source install. machine_name - Machine name under which a particular migration is registered. description - Description of the migration. group_name - The group (import job) containing this migration (import task).

Optional arguments:

source_database - Array describing the source connection, to be defined in the constructor. If absent, the source connection is assumed to be established elsewhere (typically settings.php). group - Migration group to add this migration to. dependencies - Array of migrations that must be run before this one. soft_dependencies - Array of migrations that should be listed before this one. format_mappings - Array keyed by source format IDs or machine names, with the values being the corresponding D7 machine name. If unspecified, source_options - Array to be passed as options to source constructors, overriding the defaults (map_joinable FALSE, cache_counts TRUE, cache_key derived from the machine name). version_class - The name of a custom DrupalVersion class overriding the default derived from source_version. new_only - For any destination types that support highwater marks or track_changes, suppress that support so repeated migrations only import new items.

Parameters

array $arguments:

Overrides DrupalMigration::__construct

File

includes/fieldable_panels_pane.migrate.inc, line 285
Support for fieldable_panels_pane destinations.

Class

DrupalFieldablePanelsPanesMigration
Handling specific to a Drupal 7 source for Fieldable Panels Panes.

Code

public function __construct(array $arguments) {
  $this->destinationType = $arguments['destination_type'];
  $this->sourceType = $arguments['source_type'];
  if (!empty($arguments['default_language'])) {
    $this->defaultLanguage = $arguments['default_language'];
  }
  $arguments['source_version'] = 7;
  parent::__construct($arguments);

  // Document known core fields.
  $this->sourceFields += array(
    'fpid' => t('The primary identifier for the entity.'),
    'vid' => t('The current version in use for this entity.'),
    'bundle' => t('The bundle of the entity.'),
    'title' => t('The title of the entity.'),
    'link' => t('Whether or not this entity title will link to another page.'),
    'path' => t('The path the title should link to.'),
    'reusable' => t('Whether or not this entity will appear in the Add Content dialog.'),
    'admin_title' => t('The title it will appear in the Add Content dialog as.'),
    'admin_description' => t('The description it will appear in the Add Content dialog with.'),
    'category' => t('The category it will appear in the Add Content dialog under.'),
    'view_access' => t('Access rules to describe if the user has view access to this entity.'),
    'edit_access' => t('Access rules to describe if the user has view access to this entity.'),
    'created' => t('The Unix timestamp when the entity was created.'),
    'changed' => t('The Unix timestamp when the entity was most recently saved.'),
    'uuid' => t('The Universally Unique Identifier.'),
    'language' => t('The languages.language of this entity.'),
    'uid' => t('The users.uid of the current revision.'),
    'log' => t('The log message of the current revision.'),
    'vuuid' => t('The Universally Unique Identifier of the current revision.'),
  );
  $this->sourceFields += $this->version
    ->getSourceFields('fieldable_panels_pane', $this->sourceType);
  $this->source = new MigrateSourceSQL($this
    ->query(), $this->sourceFields, NULL, $this->sourceOptions);
  $this->destination = new MigrateDestinationFieldablePanelsPanes($this->destinationType);
  $this->map = new MigrateSQLMap($this->machineName, array(
    'fpid' => array(
      'type' => 'int',
      'unsigned' => TRUE,
      'not null' => TRUE,
      'description' => 'Source entity ID',
      'alias' => 'fpp',
    ),
  ), MigrateDestinationNode::getKeySchema(), $this->mapConnection);
  if (!$this->newOnly) {
    $this->highwaterField = array(
      'name' => 'changed',
      'alias' => 'fpp',
      'type' => 'int',
    );
  }

  // Setup common mappings.
  $this
    ->addSimpleMappings(array(
    'title',
    'link',
    'path',
    'reusable',
    'admin_title',
    'admin_description',
    'category',
    'view_access',
    'edit_access',
    'created',
    'changed',
    'uuid',
    'language',
  ));
  $this
    ->addUnmigratedSources(array(
    'vid',
  ));
  $this
    ->addUnmigratedDestinations(array());
  if (isset($arguments['default_uid'])) {
    $default_uid = $arguments['default_uid'];
  }
  else {
    $default_uid = 1;
  }
}