Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php namespace Drupal\block_content; use Drupal\Core\Entity\EntityInterface; use Drupal..
Decoded Output download
<?php
namespace Drupallock_content;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityViewBuilder;
/**
* View builder handler for content blocks.
*
* Note: Content blocks (block_content entities) are not designed to be displayed
* outside of blocks! This BlockContentViewBuilder class is designed to be used
* by \Drupallock_content\Plugin\Block\BlockContentBlock::build() and by
* nothing else.
*
* @see \Drupallock_content\Plugin\Block\BlockContentBlock
*/
class BlockContentViewBuilder extends EntityViewBuilder {
/**
* {@inheritdoc}
*/
public function view(EntityInterface $entity, $view_mode = 'full', $langcode = NULL) {
return $this->viewMultiple([$entity], $view_mode, $langcode)[0];
}
/**
* {@inheritdoc}
*/
public function viewMultiple(array $entities = [], $view_mode = 'full', $langcode = NULL) {
$build_list = parent::viewMultiple($entities, $view_mode, $langcode);
// Apply the buildMultiple() #pre_render callback immediately, to make
// bubbling of attributes and contextual links to the actual block work.
// @see \Drupallock\BlockViewBuilder::buildBlock()
unset($build_list['#pre_render'][0]);
return $this->buildMultiple($build_list);
}
/**
* {@inheritdoc}
*/
protected function getBuildDefaults(EntityInterface $entity, $view_mode) {
$build = parent::getBuildDefaults($entity, $view_mode);
// The content block will be rendered in the wrapped block template already
// and thus has no entity template itself.
unset($build['#theme']);
return $build;
}
}
?>
Did this file decode correctly?
Original Code
<?php
namespace Drupal\block_content;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityViewBuilder;
/**
* View builder handler for content blocks.
*
* Note: Content blocks (block_content entities) are not designed to be displayed
* outside of blocks! This BlockContentViewBuilder class is designed to be used
* by \Drupal\block_content\Plugin\Block\BlockContentBlock::build() and by
* nothing else.
*
* @see \Drupal\block_content\Plugin\Block\BlockContentBlock
*/
class BlockContentViewBuilder extends EntityViewBuilder {
/**
* {@inheritdoc}
*/
public function view(EntityInterface $entity, $view_mode = 'full', $langcode = NULL) {
return $this->viewMultiple([$entity], $view_mode, $langcode)[0];
}
/**
* {@inheritdoc}
*/
public function viewMultiple(array $entities = [], $view_mode = 'full', $langcode = NULL) {
$build_list = parent::viewMultiple($entities, $view_mode, $langcode);
// Apply the buildMultiple() #pre_render callback immediately, to make
// bubbling of attributes and contextual links to the actual block work.
// @see \Drupal\block\BlockViewBuilder::buildBlock()
unset($build_list['#pre_render'][0]);
return $this->buildMultiple($build_list);
}
/**
* {@inheritdoc}
*/
protected function getBuildDefaults(EntityInterface $entity, $view_mode) {
$build = parent::getBuildDefaults($entity, $view_mode);
// The content block will be rendered in the wrapped block template already
// and thus has no entity template itself.
unset($build['#theme']);
return $build;
}
}
Function Calls
None |
Stats
MD5 | 0249b0d51986f42b162af8649c6c621c |
Eval Count | 0 |
Decode Time | 87 ms |