select('users', 'u') ->condition('u.picture', '', '<>') ->fields('u', ['uid', 'picture']); return $query; } /** * {@inheritdoc} */ public function initializeIterator() { $site_path = isset($this->configuration['site_path']) ? $this->configuration['site_path'] : 'sites/default'; $this->filePath = $this->variableGet('file_directory_path', $site_path . '/files') . '/'; $this->tempFilePath = $this->variableGet('file_directory_temp', '/tmp') . '/'; return parent::initializeIterator(); } /** * {@inheritdoc} */ public function prepareRow(Row $row) { $row->setSourceProperty('filename', basename($row->getSourceProperty('picture'))); $row->setSourceProperty('file_directory_path', $this->filePath); $row->setSourceProperty('temp_directory_path', $this->tempFilePath); return parent::prepareRow($row); } /** * {@inheritdoc} */ public function fields() { return [ 'picture' => "Path to the user's uploaded picture.", 'filename' => 'The picture filename.', ]; } /** * {@inheritdoc} */ public function getIds() { $ids['uid']['type'] = 'integer'; return $ids; } }