class UserPictureInstance

Same name and namespace in other branches
  1. 11.x core/modules/user/src/Plugin/migrate/source/UserPictureInstance.php \Drupal\user\Plugin\migrate\source\UserPictureInstance

Drupal 6/7 user picture field instance source from database.

For available configuration keys, refer to the parent classes.

@todo Support default picture?

Plugin annotation


@MigrateSource(
  id = "user_picture_instance",
  source_module = "user"
)

Hierarchy

Expanded class hierarchy of UserPictureInstance

See also

\Drupal\migrate\Plugin\migrate\source\SqlBase

\Drupal\migrate\Plugin\migrate\source\SourcePluginBase

File

core/modules/user/src/Plugin/migrate/source/UserPictureInstance.php, line 23

Namespace

Drupal\user\Plugin\migrate\source
View source
class UserPictureInstance extends DrupalSqlBase {
  use DummyQueryTrait;
  
  /**
   * {@inheritdoc}
   */
  public function initializeIterator() {
    return new \ArrayIterator([
      [
        'id' => '',
        'file_directory' => $this->variableGet('user_picture_path', 'pictures'),
        'max_filesize' => $this->variableGet('user_picture_file_size', '30') . 'KB',
        'max_resolution' => $this->variableGet('user_picture_dimensions', '85x85'),
      ],
    ]);
  }
  
  /**
   * {@inheritdoc}
   */
  public function fields() {
    return [
      'file_directory' => 'The directory to store images..',
      'max_filesize' => 'The maximum allowed file size in KBs.',
      'max_resolution' => "The maximum resolution.",
    ];
  }
  
  /**
   * {@inheritdoc}
   */
  public function getIds() {
    $ids['id']['type'] = 'string';
    return $ids;
  }

}

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