You are here

public function SimpleInstagramBlock::build in Simple Instagram Feed Block 8

Same name and namespace in other branches
  1. 8.3 src/Plugin/Block/SimpleInstagramBlock.php \Drupal\simple_instagram_feed\Plugin\Block\SimpleInstagramBlock::build()
  2. 8.2 src/Plugin/Block/SimpleInstagramBlock.php \Drupal\simple_instagram_feed\Plugin\Block\SimpleInstagramBlock::build()
  3. 1.0.x src/Plugin/Block/SimpleInstagramBlock.php \Drupal\simple_instagram_feed\Plugin\Block\SimpleInstagramBlock::build()

Builds and returns the renderable array for this block plugin.

If a block should not be rendered because it has no content, then this method must also ensure to return no content: it must then only return an empty array, or an empty array with #cache set (with cacheability metadata indicating the circumstances for it being empty).

Return value

array A renderable array representing the content of the block.

Overrides BlockPluginInterface::build

See also

\Drupal\block\BlockViewBuilder

File

src/Plugin/Block/SimpleInstagramBlock.php, line 100

Class

SimpleInstagramBlock
Provides a block with a dynamic Instagram Feed.

Namespace

Drupal\simple_instagram_feed\Plugin\Block

Code

public function build() {

  // Return array.
  return array(
    '#theme' => 'simple_instagram_block',
    '#markup' => t('Simple Instagram Feed'),
    '#attached' => array(
      'library' => array(
        'simple_instagram_feed/simple_instagram_block',
      ),
    ),
    '#cache' => [
      'max-age' => 3600,
    ],
  );
}