UserPicture.php

Same filename in other branches
  1. 8.9.x core/modules/user/src/Plugin/migrate/source/d6/UserPicture.php
  2. 10 core/modules/user/src/Plugin/migrate/source/d6/UserPicture.php
  3. 11.x core/modules/user/src/Plugin/migrate/source/d6/UserPicture.php

Namespace

Drupal\user\Plugin\migrate\source\d6

File

core/modules/user/src/Plugin/migrate/source/d6/UserPicture.php

View source
<?php

namespace Drupal\user\Plugin\migrate\source\d6;

use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;

/**
 * Drupal 6 user picture source from database.
 *
 * For available configuration keys, refer to the parent classes.
 *
 * @see \Drupal\migrate\Plugin\migrate\source\SqlBase
 * @see \Drupal\migrate\Plugin\migrate\source\SourcePluginBase
 *
 * @todo Support default picture?
 *
 * @MigrateSource(
 *   id = "d6_user_picture",
 *   source_module = "user"
 * )
 */
class UserPicture extends DrupalSqlBase {
    
    /**
     * {@inheritdoc}
     */
    public function query() {
        $query = $this->select('users', 'u')
            ->condition('picture', '', '<>')
            ->fields('u', [
            'uid',
            'access',
            'picture',
        ])
            ->orderBy('u.access');
        return $query;
    }
    
    /**
     * {@inheritdoc}
     */
    public function fields() {
        return [
            'uid' => 'Primary Key: Unique user ID.',
            'access' => 'Timestamp for previous time user accessed the site.',
            'picture' => "Path to the user's uploaded picture.",
        ];
    }
    
    /**
     * {@inheritdoc}
     */
    public function getIds() {
        $ids['uid']['type'] = 'integer';
        return $ids;
    }

}

Classes

Title Deprecated Summary
UserPicture Drupal 6 user picture source from database.

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