Skip to content
Snippets Groups Projects
Commit 55423a8f authored by Gareth Poole's avatar Gareth Poole
Browse files

Issue #3358346 by gareth.poole: Sector 10 - Default page config and sample content -

default news view block
parent b909d9a3
No related branches found
No related tags found
1 merge request!38Issue #3375049 "Upgrade rabbit hole"
# Sector News
Bundles ..
* content type
* news Page node
* a news sample node
* news view /admin/structure/views/view/sector_news
* some out of the box meta /admin/config/search/metatag/node__sector_news
* CT content editor permissions
Upon uninstall -
* news Page node
* all `sector_news` nodes (including default content)
* news view
* the content type
will be deleted.
\ No newline at end of file
langcode: en
status: true
dependencies:
config:
- views.view.sector_news
module:
- system
- views
theme:
- sector_starter
id: views_block__sector_news_block_default
theme: sector_starter
region: content
weight: 0
provider: null
plugin: 'views_block:sector_news-block_default'
settings:
id: 'views_block:sector_news-block_default'
label: ''
label_display: '0'
provider: views
views_label: ''
items_per_page: none
visibility:
request_path:
id: request_path
negate: false
pages: /node/7
......@@ -4,6 +4,7 @@
* Install, update and uninstall functions for the profilename install profile.
*/
use Drupal\user\Entity\Role;
use Drupal\Core\Entity\EntityInterface;
/*
......@@ -52,4 +53,32 @@ function sector_news_uninstall() {
// Delete content type.
$content_type = \Drupal::entityTypeManager()->getStorage('node_type')->load('sector_news');
$content_type->delete();
}
/**
* Implements hook_ENTITY_TYPE_insert() for node entities.
*/
function sector_news_node_insert(EntityInterface $entity) {
switch ($entity->uuid()) {
case '7aa107da-4318-4696-b649-30c0cbb55daa':
$block = Drupal\block\Entity\Block::load('views_block__sector_news_block_default');
if(!$block) {
return;
}
$block->setVisibilityConfig('request_path', array('id' => 'request_path',
'pages'=> '/node/' . $entity->id(),
'negate' => false,
)
);
$block->save();
\Drupal::logger('sector_news')->notice('Setting views_block__sector_news_block_default block visibility to appear on #%nid', [
'%nid' => $entity->id(),
]);
break;
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment