You are here

drupal-8.instagram-block-2778667.add-block.php in Instagram Block 8.2

Contains database additions to add block to Drupal.

File

tests/fixtures/update/drupal-8.instagram-block-2778667.add-block.php
View source
<?php

/**
 * @file
 * Contains database additions to add block to Drupal.
 */
use Drupal\Component\Serialization\Yaml;
use Drupal\Core\Database\Database;
$connection = Database::getConnection();

// Load the Instagram block from config.
$block_configs[] = Yaml::decode(file_get_contents(__DIR__ . '/block.block.testaccesstokenmove.yml'));
foreach ($block_configs as $block_config) {
  $connection
    ->insert('config')
    ->fields([
    'collection',
    'name',
    'data',
  ])
    ->values([
    'collection' => '',
    'name' => 'block.block.' . $block_config['id'],
    'data' => serialize($block_config),
  ])
    ->execute();
}