You are here

protected function DisqusEnabledNodeTypes::values in Disqus 8

Return the values of the variables specified in the plugin configuration.

Return value

array An associative array where the keys are the variables specified in the plugin configuration and the values are the values found in the source. Only those values are returned that are actually in the database.

2 calls to DisqusEnabledNodeTypes::values()
DisqusEnabledNodeTypes::count in src/Plugin/migrate/source/DisqusEnabledNodeTypes.php
Gets the source count.
DisqusEnabledNodeTypes::initializeIterator in src/Plugin/migrate/source/DisqusEnabledNodeTypes.php
Initializes the iterator with the source data.

File

src/Plugin/migrate/source/DisqusEnabledNodeTypes.php, line 32

Class

DisqusEnabledNodeTypes
Disqus enabled content types migration source.

Namespace

Drupal\disqus\Plugin\migrate\source

Code

protected function values() {
  $values = [];
  if ($result = $this
    ->prepareQuery()
    ->execute()
    ->fetchAllKeyed()) {
    $enabled_types = unserialize($result['disqus_nodetypes']);
    $enabled_types = array_filter($enabled_types);
    $defaults = unserialize($result['disqus_nodetypes_default']);
    $defaults = array_filter($defaults);
    foreach ($enabled_types as $type) {
      $values[] = [
        'type' => $type,
        'default' => !empty($defaults[$type]),
      ];
    }
  }
  return $values;
}