initializeIterator example



    return $query;
  }

  /** * {@inheritdoc} */
  protected function initializeIterator() {
    $this->publicPath = $this->variableGet('file_public_path', 'sites/default/files');
    $this->privatePath = $this->variableGet('file_private_path', NULL);
    return parent::initializeIterator();
  }

  /** * {@inheritdoc} */
  public function prepareRow(Row $row) {
    // Compute the filepath property, which is a physical representation of     // the URI relative to the Drupal root.     $path = str_replace(['public:/', 'private:/'][$this->publicPath, $this->privatePath]$row->getSourceProperty('uri'));
    // At this point, $path could be an absolute path or a relative path,     // depending on how the scheme's variable was set. So we need to shear out

  public function getIds() {
    $ids['module']['type'] = 'string';
    return $ids;
  }

  /** * {@inheritdoc} */
  protected function doCount() {
    return $this->initializeIterator()->count();
  }

  /** * {@inheritdoc} */
  public function prepareRow(Row $row) {
    $exists = $this->moduleExists($row->getSourceProperty('module'));
    $row->setSourceProperty('module_exists', $exists);
    return parent::prepareRow($row);
  }

}
$query->condition('n.type', (array) $this->configuration['node_type'], 'IN');
    }

    return $query;
  }

  /** * {@inheritdoc} */
  protected function initializeIterator() {
    $this->filterDefaultFormat = $this->variableGet('filter_default_format', '1');
    return parent::initializeIterator();
  }

  /** * {@inheritdoc} */
  public function fields() {
    $fields = [
      'nid' => $this->t('Node ID'),
      'type' => $this->t('Type'),
      'title' => $this->t('Title'),
      'body' => $this->t('Body'),
      

class FieldInstancePerViewMode extends FieldInstance {

  /** * {@inheritdoc} */
  protected function initializeIterator() {
    $instances = parent::initializeIterator();

    $rows = [];
    foreach ($instances->getArrayCopy() as $instance) {
      $data = unserialize($instance['data']);
      foreach ($data['display'] as $view_mode => $formatter) {
        $rows[] = array_merge($instance[
          'view_mode' => $view_mode,
          'formatter' => $formatter,
        ]);
      }
    }
    
break;
        }
      }
    }
    return $values;
  }

  /** * {@inheritdoc} */
  protected function doCount() {
    return $this->initializeIterator()->count();
  }

  /** * {@inheritdoc} */
  public function fields() {
    return array_combine($this->variables, $this->variables);
  }

  /** * {@inheritdoc} */
return $result;
  }

  /** * Returns the iterator that will yield the row arrays to be processed. * * @return \Iterator * The iterator that will yield the row arrays to be processed. */
  protected function getIterator() {
    if (!isset($this->iterator)) {
      $this->iterator = $this->initializeIterator();
    }
    return $this->iterator;
  }

  /** * {@inheritdoc} */
  #[\ReturnTypeWillChange]   public function current() {
    return $this->currentRow;
  }

  
return [
      'node_type' => $this->t('Node type'),
      'max_filesize' => $this->t('Max filesize'),
      'file_extensions' => $this->t('File extensions'),
    ];
  }

  /** * {@inheritdoc} */
  protected function doCount() {
    return count($this->initializeIterator());
  }

}
'comment_form_location' => $this->t('Location of comment submission form'),
    ];
  }

  /** * {@inheritdoc} */
  protected function initializeIterator() {
    $this->teaserLength = $this->variableGet('teaser_length', 600);
    $this->nodePreview = $this->variableGet('node_preview', 0);
    $this->themeSettings = $this->variableGet('theme_settings', []);
    return parent::initializeIterator();
  }

  /** * {@inheritdoc} */
  public function prepareRow(Row $row) {
    $row->setSourceProperty('teaser_length', $this->teaserLength);
    $row->setSourceProperty('node_preview', $this->nodePreview);

    $type = $row->getSourceProperty('type');
    $source_options = $this->variableGet('node_options_' . $type['promote', 'sticky']);
    
/** * {@inheritdoc} */
  protected function initializeIterator() {
    $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') . '/';

    // FILE_DOWNLOADS_PUBLIC == 1 and FILE_DOWNLOADS_PRIVATE == 2.     $this->isPublic = $this->variableGet('file_downloads', 1) == 1;
    return parent::initializeIterator();
  }

  /** * {@inheritdoc} */
  public function prepareRow(Row $row) {
    $row->setSourceProperty('file_directory_path', $this->filePath);
    $row->setSourceProperty('temp_directory_path', $this->tempFilePath);
    $row->setSourceProperty('is_public', $this->isPublic);
    return parent::prepareRow($row);
  }

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

/** * A base class for migrations that require view mode info. */
abstract class ViewModeBase extends DrupalSqlBase {

  /** * {@inheritdoc} */
  protected function doCount() {
    return count($this->initializeIterator());
  }

  /** * Get a list of D6 view modes. * * Drupal 6 supported the following view modes. * NODE_BUILD_NORMAL = 0 * NODE_BUILD_PREVIEW = 1 * NODE_BUILD_SEARCH_INDEX = 2 * NODE_BUILD_SEARCH_RESULT = 3 * NODE_BUILD_RSS = 4 * NODE_BUILD_PRINT = 5 * teaser * full * * @return array * The view mode names. */
'field_name' => [
        'type' => 'string',
        'alias' => 'fci',
      ],
    ];
  }

  /** * {@inheritdoc} */
  protected function doCount() {
    return $this->initializeIterator()->count();
  }

}
'comment_preview' => $this->t('Preview comment'),
      'comment_form_location' => $this->t('Location of comment submission form'),
    ];
  }

  /** * {@inheritdoc} */
  protected function initializeIterator() {
    $this->teaserLength = $this->variableGet('teaser_length', 600);
    $this->nodePreview = $this->variableGet('node_preview', 0);
    return parent::initializeIterator();
  }

  /** * {@inheritdoc} */
  public function prepareRow(Row $row) {
    $row->setSourceProperty('teaser_length', $this->teaserLength);
    $row->setSourceProperty('node_preview', $this->nodePreview);

    $type = $row->getSourceProperty('type');
    $source_options = $this->variableGet('node_options_' . $type['promote', 'sticky']);
    
->fields('u', ['uid', 'picture']);
    return $query;
  }

  /** * {@inheritdoc} */
  public function initializeIterator() {
    $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);
  }

  

        }
      }
    }
    return $values;
  }

  /** * {@inheritdoc} */
  protected function doCount() {
    return $this->initializeIterator()->count();
  }

  /** * {@inheritdoc} */
  public function fields() {
    return array_combine($this->variables, $this->variables);
  }

  /** * {@inheritdoc} */
$filter_roles = $this->select('filter_formats', 'f')
      ->fields('f', ['format', 'roles'])
      ->execute()
      ->fetchAllKeyed();
    foreach ($filter_roles as $format => $roles) {
      // Drupal 6 code: $roles = ','. implode(',', $roles) .',';       // Remove the beginning and ending comma.       foreach (explode(',', trim($roles, ',')) as $rid) {
        $this->filterPermissions[$rid][] = $format;
      }
    }
    return parent::initializeIterator();
  }

  /** * {@inheritdoc} */
  public function prepareRow(Row $row) {
    $rid = $row->getSourceProperty('rid');
    $permissions = $this->select('permission', 'p')
      ->fields('p', ['perm'])
      ->condition('rid', $rid)
      ->execute()
      
Home | Imprint | This part of the site doesn't use cookies.