441fdc78c751a43d7a5b27cac9dd033ea7a705c7
[yaffs-website] / web / core / modules / user / src / Plugin / migrate / source / UserPictureInstance.php
1 <?php
2
3 namespace Drupal\user\Plugin\migrate\source;
4
5 use Drupal\migrate_drupal\Plugin\migrate\source\DrupalSqlBase;
6 use Drupal\migrate\Plugin\migrate\source\DummyQueryTrait;
7
8 /**
9  * User picture field instance source.
10  *
11  * @todo Support default picture?
12  *
13  * @MigrateSource(
14  *   id = "user_picture_instance"
15  * )
16  */
17 class UserPictureInstance extends DrupalSqlBase {
18
19   use DummyQueryTrait;
20
21   /**
22    * {@inheritdoc}
23    */
24   public function initializeIterator() {
25     return new \ArrayIterator([
26       [
27         'id' => '',
28         'file_directory' => $this->variableGet('user_picture_path', 'pictures'),
29         'max_filesize' => $this->variableGet('user_picture_file_size', '30') . 'KB',
30         'max_resolution' => $this->variableGet('user_picture_dimensions', '85x85'),
31       ]]);
32   }
33
34   /**
35    * {@inheritdoc}
36    */
37   public function fields() {
38     return [
39       'file_directory' => 'The directory to store images..',
40       'max_filesize' => 'The maximum allowed file size in KBs.',
41       'max_resolution' => "The maximum resolution.",
42     ];
43   }
44
45   /**
46    * {@inheritdoc}
47    */
48   public function getIds() {
49     $ids['id']['type'] = 'string';
50     return $ids;
51   }
52
53 }