You are here

class FilePlainFieldWidget in Media Migration 8

Drupal 7 media field widget settings source based on source database.

Plugin annotation


@MigrateSource(
  id = "d7_file_plain_field_widget",
  source_module = "file"
)

Hierarchy

Expanded class hierarchy of FilePlainFieldWidget

File

src/Plugin/migrate/source/d7/FilePlainFieldWidget.php, line 15

Namespace

Drupal\media_migration\Plugin\migrate\source\d7
View source
class FilePlainFieldWidget extends FilePlainConfigSourceBase {

  /**
   * {@inheritdoc}
   */
  public function prepareRow(Row $row) {
    [
      'mimes' => $mimes,
      'schemes' => $schemes,
    ] = $row
      ->getSource();
    $mime = explode(static::MULTIPLE_SEPARATOR, $mimes)[0];
    $scheme = explode(static::MULTIPLE_SEPARATOR, $schemes)[0];
    if (!($dealer_plugin = $this->fileDealerManager
      ->createInstanceFromSchemeAndMime($scheme, $mime))) {
      return FALSE;
    }
    $dealer_plugin
      ->prepareMediaSourceFieldWidgetRow($row, $this
      ->getDatabase());
    return parent::prepareRow($row);
  }

  /**
   * {@inheritdoc}
   */
  public function fields() {
    return [
      'options' => $this
        ->t('Configuration options of the source field widget.'),
    ] + parent::fields();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ConfigSourceBase::MULTIPLE_SEPARATOR constant
FilePlainConfigSourceBase::$fileDealerManager protected property The file dealer plugin manager.
FilePlainConfigSourceBase::$sourceHasFileEntities protected property Whether the source has (fieldable) file entities or not.
FilePlainConfigSourceBase::create public static function
FilePlainConfigSourceBase::getIds public function 1
FilePlainConfigSourceBase::initializeIterator protected function 2
FilePlainConfigSourceBase::prepareQuery protected function
FilePlainConfigSourceBase::query public function 1
FilePlainConfigSourceBase::__construct public function Constructs a plugin instance.
FilePlainFieldWidget::fields public function Overrides FilePlainConfigSourceBase::fields
FilePlainFieldWidget::prepareRow public function
MediaMigrationDatabaseTrait::getExtensionExpression protected function Returns the file extension expression for the current DB.
MediaMigrationDatabaseTrait::getFileEntityBaseQuery protected function Returns a base query for file entity types.
MediaMigrationDatabaseTrait::getFilePlainBaseQuery protected function Returns a base query for plain files.
MediaMigrationDatabaseTrait::getMainMimeTypeExpression protected function Returns the main MIME type's expression for the current DB.
MediaMigrationDatabaseTrait::getSchemeExpression protected function Returns the expression for the DB for getting the URI scheme.
MediaMigrationDatabaseTrait::getUserPictureOnlyFidsQuery protected function Returns the subquery for the user picture-only file IDs.
MediaMigrationDatabaseTrait::getWebformOrUserPictureOnlyFidsQuery protected function Subquery for FIDs used only in webform submissions and/or by user entities.