You are here

simple_instagram_feed.module in Simple Instagram Feed Block 8.2

File

simple_instagram_feed.module
View source
<?php

/**
 * Implements hook_theme()
 */
function simple_instagram_feed_theme($existing, $type, $theme, $path) {
  $variables = array(
    'simple_instagram_block' => array(
      'variables' => [
        'markup' => [],
      ],
    ),
  );
  return $variables;
}

/**
* Implements hook_preprocess_block()
*/
function simple_instagram_feed_preprocess_block(&$variables) {
  if ($variables['plugin_id'] == 'simple_instagram_block') {
    $block_instance = str_replace('_', '-', $variables['elements']['#id']);
    $settings = $variables['elements']['#configuration'];
    $instagram_username = $settings['simple_instagram_username'];
    $instagram_display_profile = $settings['simple_instagram_display_profile'];
    $instagram_display_biography = $settings['simple_instagram_display_biography'];
    $instagram_items = $settings['simple_instagram_items'];
    $instagram_items_per_row = $settings['simple_instagram_items_per_row'] + 1;
    $variables['#attached']['drupalSettings']['simple_instagram_feed']['simple_instagram_block']['instagram_username'] = $instagram_username;
    $variables['#attached']['drupalSettings']['simple_instagram_feed']['simple_instagram_block']['display_profile'] = $instagram_display_profile;
    $variables['#attached']['drupalSettings']['simple_instagram_feed']['simple_instagram_block']['display_biography'] = $instagram_display_biography;
    $variables['#attached']['drupalSettings']['simple_instagram_feed']['simple_instagram_block']['items'] = $instagram_items;
    $variables['#attached']['drupalSettings']['simple_instagram_feed']['simple_instagram_block']['items_per_row'] = $instagram_items_per_row;
    $variables['#attached']['drupalSettings']['simple_instagram_feed']['simple_instagram_block']['block_instance'] = $block_instance;
  }
}

Functions

Namesort descending Description
simple_instagram_feed_preprocess_block Implements hook_preprocess_block()
simple_instagram_feed_theme Implements hook_theme()