2001-03-10 11:07:52 +00:00
< ? php
2000-12-23 15:20:10 +00:00
2004-08-21 06:42:38 +00:00
/**
* @ file
2009-08-28 19:44:05 +00:00
* Controls the visual building blocks a page is constructed with .
2004-08-21 06:42:38 +00:00
*/
2015-03-05 09:37:01 +00:00
use Drupal\Component\Utility\Html ;
2020-11-16 15:18:38 +00:00
use Drupal\Core\Installer\InstallerKernel ;
2014-06-30 03:33:08 +00:00
use Drupal\Core\Routing\RouteMatchInterface ;
2019-07-24 15:48:42 +00:00
use Drupal\Core\Link ;
2014-09-29 13:41:29 +00:00
use Drupal\Core\Url ;
2014-10-23 11:32:15 +00:00
use Drupal\language\ConfigurableLanguageInterface ;
2014-04-04 13:49:13 +00:00
use Drupal\system\Entity\Menu ;
2014-09-08 14:15:48 +00:00
use Drupal\block\Entity\Block ;
2013-01-08 21:01:41 +00:00
2004-05-11 20:10:14 +00:00
/**
2009-12-04 16:49:48 +00:00
* Implements hook_help () .
2004-05-11 20:10:14 +00:00
*/
2014-06-30 03:33:08 +00:00
function block_help ( $route_name , RouteMatchInterface $route_match ) {
2014-05-07 02:04:53 +00:00
switch ( $route_name ) {
case 'help.page.block' :
2019-04-16 05:38:27 +00:00
$block_content = \Drupal :: moduleHandler () -> moduleExists ( 'block_content' ) ? Url :: fromRoute ( 'help.page' , [ 'name' => 'block_content' ]) -> toString () : '#' ;
2009-11-19 05:54:42 +00:00
$output = '' ;
2009-11-22 21:24:37 +00:00
$output .= '<h3>' . t ( 'About' ) . '</h3>' ;
2017-03-04 01:20:24 +00:00
$output .= '<p>' . t ( 'The Block module allows you to place blocks in regions of your installed themes, and configure block settings. For more information, see the <a href=":blocks-documentation">online documentation for the Block module</a>.' , [ ':blocks-documentation' => 'https://www.drupal.org/documentation/modules/block/' ]) . '</p>' ;
2009-11-19 05:54:42 +00:00
$output .= '<h3>' . t ( 'Uses' ) . '</h3>' ;
$output .= '<dl>' ;
2013-12-03 15:44:48 +00:00
$output .= '<dt>' . t ( 'Placing and moving blocks' ) . '</dt>' ;
2019-04-16 05:38:27 +00:00
$output .= '<dd>' . t ( 'You can place a new block in a region by selecting <em>Place block</em> on the <a href=":blocks">Block layout page</a>. Once a block is placed, it can be moved to a different region by drag-and-drop or by using the <em>Region</em> drop-down list, and then clicking <em>Save blocks</em>.' , [ ':blocks' => Url :: fromRoute ( 'block.admin_display' ) -> toString ()]) . '</dd>' ;
2013-12-03 15:44:48 +00:00
$output .= '<dt>' . t ( 'Toggling between different themes' ) . '</dt>' ;
2014-09-19 09:25:26 +00:00
$output .= '<dd>' . t ( 'Blocks are placed and configured specifically for each theme. The Block layout page opens with the default theme, but you can toggle to other installed themes.' ) . '</dd>' ;
2015-04-14 07:33:11 +00:00
$output .= '<dt>' . t ( 'Demonstrating block regions for a theme' ) . '</dt>' ;
2019-04-16 05:38:27 +00:00
$output .= '<dd>' . t ( 'You can see where the regions are for the current theme by clicking the <em>Demonstrate block regions</em> link on the <a href=":blocks">Block layout page</a>. Regions are specific to each theme.' , [ ':blocks' => Url :: fromRoute ( 'block.admin_display' ) -> toString ()]) . '</dd>' ;
2013-12-03 15:44:48 +00:00
$output .= '<dt>' . t ( 'Configuring block settings' ) . '</dt>' ;
2019-04-16 05:38:27 +00:00
$output .= '<dd>' . t ( 'To change the settings of an individual block click on the <em>Configure</em> link on the <a href=":blocks">Block layout page</a>. The available options vary depending on the module that provides the block. For all blocks you can change the block title and toggle whether to display it.' , [ ':blocks' => Url :: fromRoute ( 'block.admin_display' ) -> toString ()]) . '</dd>' ;
2009-11-19 05:54:42 +00:00
$output .= '<dt>' . t ( 'Controlling visibility' ) . '</dt>' ;
2013-12-03 15:44:48 +00:00
$output .= '<dd>' . t ( 'You can control the visibility of a block by restricting it to specific pages, content types, and/or roles by setting the appropriate options under <em>Visibility settings</em> of the block configuration.' ) . '</dd>' ;
$output .= '<dt>' . t ( 'Adding custom blocks' ) . '</dt>' ;
2017-03-04 01:20:24 +00:00
$output .= '<dd>' . t ( 'You can add custom blocks, if the <em>Custom Block</em> module is installed. For more information, see the <a href=":blockcontent-help">Custom Block help page</a>.' , [ ':blockcontent-help' => $block_content ]) . '</dd>' ;
2009-11-19 05:54:42 +00:00
$output .= '</dl>' ;
2005-11-01 10:17:34 +00:00
return $output ;
2003-08-05 18:33:39 +00:00
}
2014-05-07 02:04:53 +00:00
if ( $route_name == 'block.admin_display' || $route_name == 'block.admin_display_theme' ) {
2014-06-30 03:33:08 +00:00
$demo_theme = $route_match -> getParameter ( 'theme' ) ? : \Drupal :: config ( 'system.theme' ) -> get ( 'default' );
2015-01-13 10:17:01 +00:00
$themes = \Drupal :: service ( 'theme_handler' ) -> listInfo ();
2015-10-05 00:47:31 +00:00
$output = '<p>' . t ( 'Block placement is specific to each theme on your site. Changes will not be saved until you click <em>Save blocks</em> at the bottom of the page.' ) . '</p>' ;
2019-07-24 15:48:42 +00:00
$output .= '<p>' . Link :: fromTextAndUrl ( t ( 'Demonstrate block regions (@theme)' , [ '@theme' => $themes [ $demo_theme ] -> info [ 'name' ]]), Url :: fromRoute ( 'block.admin_demo' , [ 'theme' => $demo_theme ])) -> toString () . '</p>' ;
2009-10-14 02:13:15 +00:00
return $output ;
}
2001-01-13 16:33:19 +00:00
}
2007-04-06 13:27:23 +00:00
/**
2009-12-04 16:49:48 +00:00
* Implements hook_theme () .
2007-04-06 13:27:23 +00:00
*/
function block_theme () {
2017-03-04 01:20:24 +00:00
return [
'block' => [
2009-10-23 22:24:19 +00:00
'render element' => 'elements' ,
2017-03-04 01:20:24 +00:00
],
];
2007-04-06 13:27:23 +00:00
}
2009-01-27 00:22:27 +00:00
/**
2014-11-14 10:43:20 +00:00
* Implements hook_page_top () .
2009-01-27 00:22:27 +00:00
*/
2014-11-14 10:43:20 +00:00
function block_page_top ( array & $page_top ) {
if ( \Drupal :: routeMatch () -> getRouteName () === 'block.admin_demo' ) {
$theme = \Drupal :: theme () -> getActiveTheme () -> getName ();
2017-03-04 01:20:24 +00:00
$page_top [ 'backlink' ] = [
2013-08-10 09:03:40 +00:00
'#type' => 'link' ,
'#title' => t ( 'Exit block region demonstration' ),
2017-03-04 01:20:24 +00:00
'#options' => [ 'attributes' => [ 'class' => [ 'block-demo-backlink' ]]],
2013-08-10 09:03:40 +00:00
'#weight' => - 10 ,
2017-03-04 01:20:24 +00:00
];
2014-10-09 06:39:37 +00:00
if ( \Drupal :: config ( 'system.theme' ) -> get ( 'default' ) == $theme ) {
2014-11-14 10:43:20 +00:00
$page_top [ 'backlink' ][ '#url' ] = Url :: fromRoute ( 'block.admin_display' );
2014-10-09 06:39:37 +00:00
}
else {
2014-11-14 10:43:20 +00:00
$page_top [ 'backlink' ][ '#url' ] = Url :: fromRoute ( 'block.admin_display_theme' , [ 'theme' => $theme ]);
2014-10-09 06:39:37 +00:00
}
2009-01-27 00:22:27 +00:00
}
}
2009-04-21 09:31:31 +00:00
/**
2014-09-19 09:25:26 +00:00
* Initializes blocks for installed themes .
2011-11-03 10:53:06 +00:00
*
* @ param $theme_list
* An array of theme names .
2020-11-16 15:18:38 +00:00
*
* @ see block_modules_installed ()
2009-04-21 09:31:31 +00:00
*/
2014-09-19 09:25:26 +00:00
function block_themes_installed ( $theme_list ) {
2020-11-16 15:18:38 +00:00
// Disable this functionality prior to install profile installation because
// block configuration is often optional or provided by the install profile
// itself. block_theme_initialize() will be called when the install profile is
// installed.
if ( InstallerKernel :: installationAttempted () && \Drupal :: config ( 'core.extension' ) -> get ( 'module.' . \Drupal :: installProfile ()) === NULL ) {
return ;
}
2009-12-01 00:39:35 +00:00
foreach ( $theme_list as $theme ) {
2015-11-06 23:09:03 +00:00
// Don't initialize themes that are not displayed in the UI.
if ( \Drupal :: service ( 'theme_handler' ) -> hasUi ( $theme )) {
block_theme_initialize ( $theme );
}
2009-04-21 09:31:31 +00:00
}
}
/**
2011-11-03 10:53:06 +00:00
* Assigns an initial , default set of blocks for a theme .
2009-04-26 16:30:28 +00:00
*
2014-09-19 09:25:26 +00:00
* This function is called the first time a new theme is installed . The new
* theme gets a copy of the default theme ' s blocks , with the difference that if
* a particular region isn ' t available in the new theme , the block is assigned
2009-04-21 09:31:31 +00:00
* to the new theme ' s default region .
2009-04-26 16:30:28 +00:00
*
2009-04-21 09:31:31 +00:00
* @ param $theme
* The name of a theme .
*/
2009-07-14 10:22:17 +00:00
function block_theme_initialize ( $theme ) {
2009-04-21 09:31:31 +00:00
// Initialize theme's blocks if none already registered.
2017-03-04 01:20:24 +00:00
$has_blocks = \Drupal :: entityTypeManager () -> getStorage ( 'block' ) -> loadByProperties ([ 'theme' => $theme ]);
2009-05-16 15:23:16 +00:00
if ( ! $has_blocks ) {
2013-09-16 03:58:06 +00:00
$default_theme = \Drupal :: config ( 'system.theme' ) -> get ( 'default' );
2011-07-03 17:57:21 +00:00
// Apply only to new theme's visible regions.
$regions = system_region_list ( $theme , REGIONS_VISIBLE );
2017-03-04 01:20:24 +00:00
$default_theme_blocks = \Drupal :: entityTypeManager () -> getStorage ( 'block' ) -> loadByProperties ([ 'theme' => $default_theme ]);
2013-01-17 04:03:30 +00:00
foreach ( $default_theme_blocks as $default_theme_block_id => $default_theme_block ) {
2023-01-27 12:37:01 +00:00
if ( str_starts_with ( $default_theme_block_id , $default_theme . '_' )) {
2013-10-16 00:51:01 +00:00
$id = str_replace ( $default_theme , $theme , $default_theme_block_id );
}
else {
$id = $theme . '_' . $default_theme_block_id ;
}
Issue #2030571 by calebtr, daffie, filijonka, YesCT, Thomas Brekelmans, alexpott, Mile23, tadityar, Sharique, tim.plunkett, boztek: Expand Block with methods
2015-01-12 17:47:19 +00:00
$block = $default_theme_block -> createDuplicateBlock ( $id , $theme );
Issue #1535868 by EclipseGc, tim.plunkett, xjm, Jody Lynn, sdboyer, naxoc, tizzo, effulgentsia, dawehner, disasm, beejeebus: Convert all blocks into plugins.
2013-01-04 17:05:13 +00:00
// If the region isn't supported by the theme, assign the block to the
// theme's default region.
Issue #2030571 by calebtr, daffie, filijonka, YesCT, Thomas Brekelmans, alexpott, Mile23, tadityar, Sharique, tim.plunkett, boztek: Expand Block with methods
2015-01-12 17:47:19 +00:00
if ( ! isset ( $regions [ $block -> getRegion ()])) {
$block -> setRegion ( system_default_region ( $theme ));
Issue #1535868 by EclipseGc, tim.plunkett, xjm, Jody Lynn, sdboyer, naxoc, tizzo, effulgentsia, dawehner, disasm, beejeebus: Convert all blocks into plugins.
2013-01-04 17:05:13 +00:00
}
2013-01-17 04:03:30 +00:00
$block -> save ();
2009-04-21 09:31:31 +00:00
}
}
}
2020-11-16 15:18:38 +00:00
/**
* Implements hook_modules_installed () .
*
* @ see block_themes_installed ()
*/
function block_modules_installed ( $modules ) {
// block_themes_installed() does not call block_theme_initialize() during site
// installation because block configuration can be optional or provided by the
// profile. Now, when the profile is installed, this configuration exists,
// call block_theme_initialize() for all installed themes.
$profile = \Drupal :: installProfile ();
if ( in_array ( $profile , $modules , TRUE )) {
foreach ( \Drupal :: service ( 'theme_handler' ) -> listInfo () as $theme => $data ) {
block_theme_initialize ( $theme );
}
}
}
2012-05-03 15:09:39 +00:00
/**
* Implements hook_rebuild () .
*/
function block_rebuild () {
2015-07-08 06:27:47 +00:00
foreach ( \Drupal :: service ( 'theme_handler' ) -> listInfo () as $theme => $data ) {
2012-10-09 20:32:40 +00:00
if ( $data -> status ) {
2015-07-08 06:27:47 +00:00
$regions = system_region_list ( $theme );
/** @var \Drupal\block\BlockInterface[] $blocks */
2016-05-17 09:39:03 +00:00
$blocks = \Drupal :: entityTypeManager () -> getStorage ( 'block' ) -> loadByProperties ([ 'theme' => $theme ]);
2015-07-08 06:27:47 +00:00
foreach ( $blocks as $block_id => $block ) {
// Disable blocks in invalid regions.
2016-08-08 12:16:02 +00:00
if ( ! isset ( $regions [ $block -> getRegion ()])) {
if ( $block -> status ()) {
2018-05-01 09:15:07 +00:00
\Drupal :: messenger ()
-> addWarning ( t ( 'The block %info was assigned to the invalid region %region and has been disabled.' , [
'%info' => $block_id ,
'%region' => $block -> getRegion (),
]));
2015-07-08 06:27:47 +00:00
}
2016-08-08 12:16:02 +00:00
$block
-> setRegion ( system_default_region ( $theme ))
-> disable ()
-> save ();
2015-07-08 06:27:47 +00:00
}
}
2012-10-09 20:32:40 +00:00
}
2010-06-15 16:19:28 +00:00
}
2009-02-03 12:30:14 +00:00
}
2009-04-26 01:15:04 +00:00
2013-09-29 07:19:59 +00:00
/**
* Implements hook_theme_suggestions_HOOK () .
*/
function block_theme_suggestions_block ( array $variables ) {
2017-03-04 01:20:24 +00:00
$suggestions = [];
2013-09-29 07:19:59 +00:00
2014-04-01 21:14:13 +00:00
$suggestions [] = 'block__' . $variables [ 'elements' ][ '#configuration' ][ 'provider' ];
2013-09-29 07:19:59 +00:00
// Hyphens (-) and underscores (_) play a special role in theme suggestions.
// Theme suggestions should only contain underscores, because within
// drupal_find_theme_templates(), underscores are converted to hyphens to
// match template file names, and then converted back to underscores to match
// pre-processing and other function names. So if your theme suggestion
// contains a hyphen, it will end up as an underscore after this conversion,
// and your function names won't be recognized. So, we need to convert
// hyphens to underscores in block deltas for the theme suggestions.
// We can safely explode on : because we know the Block plugin type manager
// enforces that delimiter for all derivatives.
$parts = explode ( ':' , $variables [ 'elements' ][ '#plugin_id' ]);
$suggestion = 'block' ;
while ( $part = array_shift ( $parts )) {
$suggestions [] = $suggestion .= '__' . strtr ( $part , '-' , '_' );
}
2014-06-22 05:10:13 +00:00
if ( ! empty ( $variables [ 'elements' ][ '#id' ])) {
$suggestions [] = 'block__' . $variables [ 'elements' ][ '#id' ];
2013-09-29 07:19:59 +00:00
}
return $suggestions ;
}
2009-04-26 01:15:04 +00:00
/**
Issue #1898034 by Cottser, jenlampton, joelpittet, Shawn DeArmond, idflood, Hydra, artofeclipse, rich.yumul, chrisjlee, gnuget, c4rl, thund3rbox: block.module - Convert PHPTemplate templates to Twig.
2013-05-24 17:14:30 +00:00
* Prepares variables for block templates .
*
* Default template : block . html . twig .
2009-04-26 01:15:04 +00:00
*
2011-11-03 10:53:06 +00:00
* Prepares the values passed to the theme_block function to be passed
2009-04-26 01:15:04 +00:00
* into a pluggable template engine . Uses block properties to generate a
* series of template file suggestions . If none are found , the default
Issue #1898034 by Cottser, jenlampton, joelpittet, Shawn DeArmond, idflood, Hydra, artofeclipse, rich.yumul, chrisjlee, gnuget, c4rl, thund3rbox: block.module - Convert PHPTemplate templates to Twig.
2013-05-24 17:14:30 +00:00
* block . html . twig is used .
2009-04-26 01:15:04 +00:00
*
Issue #1898034 by Cottser, jenlampton, joelpittet, Shawn DeArmond, idflood, Hydra, artofeclipse, rich.yumul, chrisjlee, gnuget, c4rl, thund3rbox: block.module - Convert PHPTemplate templates to Twig.
2013-05-24 17:14:30 +00:00
* Most themes use their own copy of block . html . twig . The default is located
* inside " core/modules/block/templates/block.html.twig " . Look in there for the
* full list of available variables .
2009-04-26 01:15:04 +00:00
*
Issue #1898034 by Cottser, jenlampton, joelpittet, Shawn DeArmond, idflood, Hydra, artofeclipse, rich.yumul, chrisjlee, gnuget, c4rl, thund3rbox: block.module - Convert PHPTemplate templates to Twig.
2013-05-24 17:14:30 +00:00
* @ param array $variables
* An associative array containing :
* - elements : An associative array containing the properties of the element .
* Properties used : #block, #configuration, #children, #plugin_id.
2009-04-26 01:15:04 +00:00
*/
function template_preprocess_block ( & $variables ) {
2013-05-11 10:01:25 +00:00
$variables [ 'configuration' ] = $variables [ 'elements' ][ '#configuration' ];
$variables [ 'plugin_id' ] = $variables [ 'elements' ][ '#plugin_id' ];
2013-12-19 17:57:48 +00:00
$variables [ 'base_plugin_id' ] = $variables [ 'elements' ][ '#base_plugin_id' ];
$variables [ 'derivative_plugin_id' ] = $variables [ 'elements' ][ '#derivative_plugin_id' ];
2022-10-03 10:44:57 +00:00
$variables [ 'in_preview' ] = $variables [ 'elements' ][ '#in_preview' ] ? ? FALSE ;
2013-05-11 10:01:25 +00:00
$variables [ 'label' ] = ! empty ( $variables [ 'configuration' ][ 'label_display' ]) ? $variables [ 'configuration' ][ 'label' ] : '' ;
$variables [ 'content' ] = $variables [ 'elements' ][ 'content' ];
2014-03-22 22:00:38 +00:00
// A block's label is configuration: it is static. Allow dynamic labels to be
// set in the render array.
if ( isset ( $variables [ 'elements' ][ 'content' ][ '#title' ]) && ! empty ( $variables [ 'configuration' ][ 'label_display' ])) {
$variables [ 'label' ] = $variables [ 'elements' ][ 'content' ][ '#title' ];
}
2009-05-21 21:12:25 +00:00
2010-04-26 14:10:40 +00:00
// Create a valid HTML ID and make sure it is unique.
2014-06-22 05:10:13 +00:00
if ( ! empty ( $variables [ 'elements' ][ '#id' ])) {
2015-03-05 09:37:01 +00:00
$variables [ 'attributes' ][ 'id' ] = Html :: getUniqueId ( 'block-' . $variables [ 'elements' ][ '#id' ]);
Issue #1535868 by EclipseGc, tim.plunkett, xjm, Jody Lynn, sdboyer, naxoc, tizzo, effulgentsia, dawehner, disasm, beejeebus: Convert all blocks into plugins.
2013-01-04 17:05:13 +00:00
}
2014-06-13 02:46:38 +00:00
// Proactively add aria-describedby if possible to improve accessibility.
2014-06-22 05:10:13 +00:00
if ( $variables [ 'label' ] && isset ( $variables [ 'attributes' ][ 'role' ])) {
2015-03-05 09:37:01 +00:00
$variables [ 'title_attributes' ][ 'id' ] = Html :: getUniqueId ( $variables [ 'label' ]);
2014-06-22 05:10:13 +00:00
$variables [ 'attributes' ][ 'aria-describedby' ] = $variables [ 'title_attributes' ][ 'id' ];
2014-06-13 02:46:38 +00:00
}
2009-05-28 16:44:07 +00:00
}
2009-08-26 10:29:26 +00:00
2009-08-27 20:25:29 +00:00
/**
2014-07-11 12:04:53 +00:00
* Implements hook_ENTITY_TYPE_delete () for user_role entities .
2009-08-27 20:25:29 +00:00
*
2011-11-03 10:53:06 +00:00
* Removes deleted role from blocks that use it .
2009-08-27 20:25:29 +00:00
*/
function block_user_role_delete ( $role ) {
2014-09-08 14:15:48 +00:00
foreach ( Block :: loadMultiple () as $block ) {
2021-05-20 20:47:18 +00:00
/** @var \Drupal\block\BlockInterface $block */
2014-06-17 17:53:40 +00:00
$visibility = $block -> getVisibility ();
if ( isset ( $visibility [ 'user_role' ][ 'roles' ][ $role -> id ()])) {
unset ( $visibility [ 'user_role' ][ 'roles' ][ $role -> id ()]);
2015-08-11 08:08:42 +00:00
$block -> setVisibilityConfig ( 'user_role' , $visibility [ 'user_role' ]);
2013-01-17 04:03:30 +00:00
$block -> save ();
Issue #1535868 by EclipseGc, tim.plunkett, xjm, Jody Lynn, sdboyer, naxoc, tizzo, effulgentsia, dawehner, disasm, beejeebus: Convert all blocks into plugins.
2013-01-04 17:05:13 +00:00
}
}
2009-08-27 20:25:29 +00:00
}
2009-10-09 08:02:25 +00:00
/**
2014-07-11 12:04:53 +00:00
* Implements hook_ENTITY_TYPE_delete () for menu entities .
2009-10-09 08:02:25 +00:00
*/
2014-04-04 13:49:13 +00:00
function block_menu_delete ( Menu $menu ) {
if ( ! $menu -> isSyncing ()) {
2014-09-08 14:15:48 +00:00
foreach ( Block :: loadMultiple () as $block ) {
Issue #2030571 by calebtr, daffie, filijonka, YesCT, Thomas Brekelmans, alexpott, Mile23, tadityar, Sharique, tim.plunkett, boztek: Expand Block with methods
2015-01-12 17:47:19 +00:00
if ( $block -> getPluginId () == 'system_menu_block:' . $menu -> id ()) {
2014-04-04 13:49:13 +00:00
$block -> delete ();
}
Issue #1535868 by EclipseGc, tim.plunkett, xjm, Jody Lynn, sdboyer, naxoc, tizzo, effulgentsia, dawehner, disasm, beejeebus: Convert all blocks into plugins.
2013-01-04 17:05:13 +00:00
}
}
2009-10-09 08:02:25 +00:00
}
2012-04-19 17:45:46 +00:00
/**
2014-08-10 21:19:32 +00:00
* Implements hook_ENTITY_TYPE_delete () for 'configurable_language' .
2012-04-19 17:45:46 +00:00
*
* Delete the potential block visibility settings of the deleted language .
*/
2014-10-23 11:32:15 +00:00
function block_configurable_language_delete ( ConfigurableLanguageInterface $language ) {
2012-04-19 17:45:46 +00:00
// Remove the block visibility settings for the deleted language.
2014-09-08 14:15:48 +00:00
foreach ( Block :: loadMultiple () as $block ) {
2021-05-20 20:47:18 +00:00
/** @var \Drupal\block\BlockInterface $block */
2014-06-17 17:53:40 +00:00
$visibility = $block -> getVisibility ();
2014-03-25 19:51:00 +00:00
if ( isset ( $visibility [ 'language' ][ 'langcodes' ][ $language -> id ()])) {
unset ( $visibility [ 'language' ][ 'langcodes' ][ $language -> id ()]);
2014-11-19 21:03:06 +00:00
$block -> setVisibilityConfig ( 'language' , $visibility [ 'language' ]);
2013-01-17 04:03:30 +00:00
$block -> save ();
Issue #1535868 by EclipseGc, tim.plunkett, xjm, Jody Lynn, sdboyer, naxoc, tizzo, effulgentsia, dawehner, disasm, beejeebus: Convert all blocks into plugins.
2013-01-04 17:05:13 +00:00
}
}
2010-03-09 12:09:52 +00:00
}