variableGet example

public function prepareRow(Row $row) {
    $cid = $row->getSourceProperty('cid');

    $node_type = $row->getSourceProperty('node_type');
    $comment_type = 'comment_node_' . $node_type;
    $row->setSourceProperty('comment_type', 'comment_node_' . $node_type);

    // If this entity was translated using Entity Translation, we need to get     // its source language to get the field values in the right language.     // The translations will be migrated by the d7_comment_entity_translation     // migration.     $entity_translatable = $this->isEntityTranslatable('comment') && (int) $this->variableGet('language_content_type_' . $node_type, 0) === 4;
    $source_language = $this->getEntityTranslationSourceLanguage('comment', $cid);
    $language = $entity_translatable && $source_language ? $source_language : $row->getSourceProperty('language');

    // Get Field API field values.     foreach ($this->getFields('comment', $comment_type) as $field_name => $field) {
      // Ensure we're using the right language if the entity and the field are       // translatable.       $field_language = $entity_translatable && $field['translatable'] ? $language : NULL;
      $row->setSourceProperty($field_name$this->getFieldValues('comment', $field_name$cid, NULL, $field_language));
    }

    
/** * {@inheritdoc} */
  protected function initializeIterator() {
    return new \ArrayIterator($this->values());
  }

  /** * {@inheritdoc} */
  protected function values() {
    $search_active_modules = $this->variableGet('search_active_modules', '');
    $values = [];
    foreach (['node', 'user'] as $module) {
      if (isset($search_active_modules[$module])) {
        // Add a module key to identify the source search provider. This value         // is used in the EntitySearchPage destination plugin.         $tmp = [
          'module' => $module,
          'status' => $search_active_modules[$module],
        ];
        // Add the node_rank_* variables (only relevant to the node module).         if ($module === 'node') {
          
/** * Checks if an entity type uses Entity Translation. * * @param string $entity_type * The entity type. * * @return bool * Whether the entity type uses entity translation. */
  protected function isEntityTranslatable($entity_type) {
    return in_array($entity_type$this->variableGet('entity_translation_entity_types', []), TRUE);
  }

  /** * Gets an entity source language from the 'entity_translation' table. * * @param string $entity_type * The entity type. * @param int $entity_id * The entity ID. * * @return string|bool * The entity source language or FALSE if no source language was found. */
/** * Wrapper method to test protected method getModuleSchemaVersion(). */
  public function getModuleSchemaVersionWrapper($module) {
    return parent::getModuleSchemaVersion($module);
  }

  /** * Wrapper method to test protected method variableGet(). */
  public function variableGetWrapper($name$default) {
    return parent::variableGet($name$default);
  }

  /** * {@inheritdoc} */
  public function getIds() {
    return [];
  }

}
'format' => $this->t("Format of the term description."),
    ];
    return $fields;
  }

  /** * {@inheritdoc} */
  public function prepareRow(Row $row) {
    $tid = $row->getSourceProperty('tid');
    $vocabulary = $row->getSourceProperty('machine_name');
    $default_language = (array) $this->variableGet('language_default', ['language' => 'en']);

    // If this entity was translated using Entity Translation, we need to get     // its source language to get the field values in the right language.     // The translations will be migrated by the d7_node_entity_translation     // migration.     $translatable_vocabularies = array_keys(array_filter($this->variableGet('entity_translation_taxonomy', [])));
    $entity_translatable = $this->isEntityTranslatable('taxonomy_term') && in_array($vocabulary$translatable_vocabularies, TRUE);

    if ($entity_translatable) {
      $source_language = $this->getEntityTranslationSourceLanguage('taxonomy_term', $tid);
      $language = $entity_translatable && $source_language ? $source_language : $default_language['language'];
    }


  /** * {@inheritdoc} */
  public function prepareRow(Row $row) {
    // In D6, status=0 means published, while in D8 means the opposite.     $row->setSourceProperty('status', !$row->getSourceProperty('status'));

    // If node did not have a language, use site default language as a fallback.     if (!$row->getSourceProperty('language')) {
      $language_default = $this->variableGet('language_default', NULL);
      $language = $language_default ? $language_default->language : 'en';
      $row->setSourceProperty('language', $language);
    }
    return parent::prepareRow($row);
  }

  /** * {@inheritdoc} */
  public function fields() {
    return [
      
// If two or more files have the same timestamp, they'll end up in a       // non-deterministic order. Ordering by fid (or any other unique field)       // will prevent this.       ->orderBy('f.fid');
  }

  /** * {@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) {
    
'language_content_type' => $this->t('Multilingual support.'),
      'i18n_lock_node' => $this->t('Lock language.'),
    ];
    return $fields;
  }

  /** * {@inheritdoc} */
  public function prepareRow(Row $row) {
    $type = $row->getSourceProperty('type');
    $row->setSourceProperty('language_content_type', $this->variableGet('language_content_type_' . $type, NULL));
    $i18n_node_options = $this->variableGet('i18n_node_options_' . $type, NULL);
    if ($i18n_node_options && in_array('lock', $i18n_node_options)) {
      $row->setSourceProperty('i18n_lock_node', 1);
    }
    else {
      $row->setSourceProperty('i18n_lock_node', 0);
    }

    // Get the entity translation entity settings.     $entity_translation_entity_types = $this->variableGet('entity_translation_entity_types', NULL);
    $row->setSourceProperty('entity_translation_entity_types', $entity_translation_entity_types);
    
/** * {@inheritdoc} */
  public function prepareRow(Row $row) {
    // Get the i18n taxonomy translation setting for this vocabulary.     // 0 - No multilingual options     // 1 - Localizable terms. Run through the localization system.     // 2 - Predefined language for a vocabulary and its terms.     // 3 - Per-language terms, translatable (referencing terms with different     // languages) but not localizable.     $i18ntaxonomy_vocabulary = $this->variableGet('i18ntaxonomy_vocabulary', []);
    $vid = $row->getSourceProperty('vid');
    $state = 0;
    if (array_key_exists($vid$i18ntaxonomy_vocabulary)) {
      $state = $i18ntaxonomy_vocabulary[$vid];
    }
    $row->setSourceProperty('state', $state);
    return parent::prepareRow($row);
  }

  /** * {@inheritdoc} */

  public function prepareRow(Row $row) {
    $nid = $row->getSourceProperty('nid');
    $vid = $row->getSourceProperty('vid');
    $type = $row->getSourceProperty('type');

    // If this entity was translated using Entity Translation, we need to get     // its source language to get the field values in the right language.     // The translations will be migrated by the d7_node_entity_translation     // migration.     $entity_translatable = $this->isEntityTranslatable('node') && (int) $this->variableGet('language_content_type_' . $type, 0) === 4;
    $source_language = $this->getEntityTranslationSourceLanguage('node', $nid);
    $language = $entity_translatable && $source_language ? $source_language : $row->getSourceProperty('language');

    // If this is using d7_node_complete source plugin and this is a node     // using entity translation then set the language of this revision to the     // entity translation language.     if ($row->getSourceProperty('etr_created')) {
      $language = $row->getSourceProperty('language');
    }

    // Get Field API field values.
public function query() {
    return $this->select('node_type', 't')
      ->fields('t', ['type', 'name']);
  }

  /** * {@inheritdoc} */
  public function prepareRow(Row $row) {
    $node_type = $row->getSourceProperty('type');
    foreach (array_keys($this->getCommentFields()) as $field) {
      $row->setSourceProperty($field$this->variableGet($field . '_' . $node_type, NULL));
    }

    return parent::prepareRow($row);
  }

  /** * {@inheritdoc} */
  public function fields() {
    return [
      'name' => $this->t('Human name of the parent node type.'),
      
/** * {@inheritdoc} */
  public function prepareRow(Row $row) {
    // Get the i18n taxonomy translation setting for this vocabulary.     // 0 - No multilingual options     // 1 - Localizable terms. Run through the localization system.     // 2 - Predefined language for a vocabulary and its terms.     // 3 - Per-language terms, translatable (referencing terms with different     // languages) but not localizable.     $i18ntaxonomy_vocab = $this->variableGet('i18ntaxonomy_vocabulary', []);
    $vid = $row->getSourceProperty('vid');
    $i18ntaxonomy_vocabulary = FALSE;
    if (array_key_exists($vid$i18ntaxonomy_vocab)) {
      $i18ntaxonomy_vocabulary = $i18ntaxonomy_vocab[$vid];
    }
    $row->setSourceProperty('i18ntaxonomy_vocabulary', $i18ntaxonomy_vocabulary);
    return parent::prepareRow($row);
  }

  /** * {@inheritdoc} */

      $description_field = $row->getSourceProperty('description_field');
      if (isset($description_field[0]['value'])) {
        $row->setSourceProperty('description', $description_field[0]['value']);
      }
      if (isset($description_field[0]['format'])) {
        $row->setSourceProperty('format', $description_field[0]['format']);
      }
    }

    // Determine if this is a forum container.     $forum_container_tids = $this->variableGet('forum_containers', []);
    $row->setSourceProperty('is_container', in_array($tid$forum_container_tids));

    return parent::prepareRow($row);
  }

  /** * {@inheritdoc} */
  public function fields() {
    return [
      'entity_type' => $this->t('The entity type this translation relates to'),
      
'language_content_type' => $this->t('Multilingual support.'),
      'i18n_lock_node' => $this->t('Lock language.'),
    ];
    return $fields;
  }

  /** * {@inheritdoc} */
  public function prepareRow(Row $row) {
    $type = $row->getSourceProperty('type');
    $row->setSourceProperty('language_content_type', $this->variableGet('language_content_type_' . $type, NULL));
    $row->setSourceProperty('i18n_lock_node', $this->variableGet('i18n_lock_node_' . $type, 0));
    return parent::prepareRow($row);
  }

  /** * {@inheritdoc} */
  public function getIds() {
    $ids['type']['type'] = 'string';
    return $ids;
  }

}

    // Drupal 6 & 7 both use the same name for the user roles table.     $this->userRoleTable = 'role';

    return $this->select($this->blockTable, 'b')->fields('b');
  }

  /** * {@inheritdoc} */
  protected function initializeIterator() {
    $this->defaultTheme = $this->variableGet('theme_default', 'Garland');
    $this->adminTheme = $this->variableGet('admin_theme', NULL);
    return parent::initializeIterator();
  }

  /** * {@inheritdoc} */
  public function fields() {
    return [
      'bid' => $this->t('The block numeric identifier.'),
      'module' => $this->t('The module providing the block.'),
      
Home | Imprint | This part of the site doesn't use cookies.