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

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

sector resource (optional)
parent 55423a8f
No related branches found
No related tags found
1 merge request!38Issue #3375049 "Upgrade rabbit hole"
Showing
with 516 additions and 0 deletions
uuid: df399bef-0509-408b-8e6b-3c86082f529a
langcode: en
status: true
dependencies:
module:
- menu_ui
third_party_settings:
menu_ui:
available_menus: { }
parent: ''
name: Resource
type: sector_resource
description: 'Use <em>Resource</em> for single page resources and to add documents.'
help: ''
new_revision: true
preview_mode: 1
display_submitted: false
uuid: 8b8bf686-6244-42f3-8b9b-a83e88ddb1a9
langcode: en
status: true
dependencies:
config:
- field.field.node.sector_resource.body
- field.field.node.sector_resource.field_issue_date
- node.type.sector_resource
module:
- datetime
- path
- text
id: node.sector_resource.default
targetEntityType: node
bundle: sector_resource
mode: default
content:
body:
type: text_textarea_with_summary
weight: 9
region: content
settings:
rows: 9
summary_rows: 3
placeholder: ''
show_summary: false
third_party_settings: { }
created:
type: datetime_timestamp
weight: 3
region: content
settings: { }
third_party_settings: { }
field_issue_date:
type: datetime_default
weight: 1
region: content
settings: { }
third_party_settings: { }
path:
type: path
weight: 6
region: content
settings: { }
third_party_settings: { }
promote:
type: boolean_checkbox
weight: 4
region: content
settings:
display_label: true
third_party_settings: { }
status:
type: boolean_checkbox
weight: 8
region: content
settings:
display_label: true
third_party_settings: { }
sticky:
type: boolean_checkbox
weight: 5
region: content
settings:
display_label: true
third_party_settings: { }
title:
type: string_textfield
weight: 0
region: content
settings:
size: 60
placeholder: ''
third_party_settings: { }
uid:
type: entity_reference_autocomplete
weight: 2
region: content
settings:
match_operator: CONTAINS
match_limit: 10
size: 60
placeholder: ''
third_party_settings: { }
url_redirects:
weight: 7
region: content
settings: { }
third_party_settings: { }
hidden: { }
uuid: e62a3a69-34e8-4f69-af0f-f779a056d441
langcode: en
status: true
dependencies:
config:
- field.field.node.sector_resource.body
- field.field.node.sector_resource.field_issue_date
- node.type.sector_resource
module:
- datetime
- text
- user
id: node.sector_resource.default
targetEntityType: node
bundle: sector_resource
mode: default
content:
body:
type: text_default
label: hidden
settings: { }
third_party_settings: { }
weight: 101
region: content
field_issue_date:
type: datetime_default
label: above
settings:
timezone_override: ''
format_type: medium
third_party_settings: { }
weight: 102
region: content
links:
settings: { }
third_party_settings: { }
weight: 100
region: content
hidden:
search_api_excerpt: true
uuid: ca4a239a-4cf7-48b1-9fd9-a8cff33832d6
langcode: en
status: true
dependencies:
config:
- core.entity_view_mode.node.full
- field.field.node.sector_resource.body
- field.field.node.sector_resource.field_issue_date
- node.type.sector_resource
module:
- text
- user
id: node.sector_resource.full
targetEntityType: node
bundle: sector_resource
mode: full
content:
body:
type: text_default
label: hidden
settings: { }
third_party_settings: { }
weight: 101
region: content
links:
settings: { }
third_party_settings: { }
weight: 100
region: content
hidden:
field_issue_date: true
search_api_excerpt: true
uuid: 3dc21863-e958-4b71-a33b-ff92e3c748bd
langcode: en
status: true
dependencies:
config:
- core.entity_view_mode.node.teaser
- field.field.node.sector_resource.body
- field.field.node.sector_resource.field_issue_date
- node.type.sector_resource
module:
- text
- user
id: node.sector_resource.teaser
targetEntityType: node
bundle: sector_resource
mode: teaser
content:
body:
type: text_summary_or_trimmed
label: hidden
settings:
trim_length: 600
third_party_settings: { }
weight: 101
region: content
links:
settings: { }
third_party_settings: { }
weight: 100
region: content
hidden:
field_issue_date: true
search_api_excerpt: true
uuid: 369ae237-ee81-48a5-9ff3-c0db9dcb741c
langcode: en
status: true
dependencies:
config:
- field.storage.node.body
- node.type.sector_resource
module:
- text
id: node.sector_resource.body
field_name: body
entity_type: node
bundle: sector_resource
label: Body
description: ''
required: false
translatable: true
default_value: { }
default_value_callback: ''
settings:
display_summary: true
required_summary: false
field_type: text_with_summary
uuid: 9f7b4422-be85-4ea5-934d-38543e4dfb69
langcode: en
status: true
dependencies:
config:
- field.storage.node.field_issue_date
- node.type.sector_resource
module:
- datetime
id: node.sector_resource.field_issue_date
field_name: field_issue_date
entity_type: node
bundle: sector_resource
label: 'Issue date'
description: ''
required: false
translatable: true
default_value:
-
default_date_type: now
default_date: now
default_value_callback: ''
settings: { }
field_type: datetime
uuid: 602beacd-4d42-41a4-8df8-3cd7caf6047d
langcode: en
status: true
dependencies:
config:
- node.type.sector_resource
id: node_type_sector_resource
entity_type_id: node_type
entity_id: sector_resource
action: display_page
allow_override: 1
redirect: ''
redirect_code: 301
redirect_fallback_action: access_denied
_meta:
version: '1.0'
entity_type: menu_link_content
uuid: 0654d01d-264f-4520-b823-163c7cefd722
bundle: menu_link_content
default_langcode: en
depends:
3820bee2-d24d-4ef0-9a3f-20a9eb1d6076: menu_link_content
5d52aa52-3100-4fba-b937-2079f24b8690: node
default:
enabled:
-
value: true
title:
-
value: Resources
menu_name:
-
value: sector-main-menu
link:
-
target_uuid: 5d52aa52-3100-4fba-b937-2079f24b8690
title: ''
options: { }
external:
-
value: false
rediscover:
-
value: false
weight:
-
value: 11
expanded:
-
value: false
parent:
-
value: 'menu_link_content:3820bee2-d24d-4ef0-9a3f-20a9eb1d6076'
revision_translation_affected:
-
value: true
\ No newline at end of file
_meta:
version: '1.0'
entity_type: node
uuid: 5d52aa52-3100-4fba-b937-2079f24b8690
bundle: page
default_langcode: en
default:
revision_uid:
-
target_id: 1
status:
-
value: true
uid:
-
target_id: 1
title:
-
value: Resources
created:
-
value: 1684116005
promote:
-
value: false
sticky:
-
value: false
revision_translation_affected:
-
value: true
path:
-
alias: ''
langcode: en
pathauto: 0
rh_action:
-
value: bundle_default
rh_redirect_response:
-
value: 301
rh_redirect_fallback_action:
-
value: bundle_default
\ No newline at end of file
_meta:
version: '1.0'
entity_type: node
uuid: c1cbb0e6-0bbd-4ea7-b1b0-8a1f290f7bbb
bundle: sector_resource
default_langcode: en
default:
revision_uid:
-
target_id: 1
status:
-
value: true
uid:
-
target_id: 1
title:
-
value: 'Resource content sample'
created:
-
value: 1684115806
promote:
-
value: true
sticky:
-
value: false
revision_translation_affected:
-
value: true
path:
-
alias: ''
langcode: en
pathauto: 0
rh_action:
-
value: bundle_default
rh_redirect_response:
-
value: 301
rh_redirect_fallback_action:
-
value: bundle_default
body:
-
value: '<p class="lead">The <em>Resource</em> content type is another example of&nbsp;taxonomy (or data) driven content. Resources&nbsp;and news items have similar fieldsets and displays; however their data type and audiences are different. Resources&nbsp;are non-transient (content remains relevant over time), while news items are transient (content becomes less relevant over time).</p><p>The Sector <em>Resource </em>content type&nbsp;is prepared for information&nbsp;or knowledge database content. The ''resource type'' taxonomy allows you to sort and filter resource pages&nbsp;into groups, such as training materials or&nbsp;manuals. The resource archive allows the user to filter by issue date or type.&nbsp;</p><p>This&nbsp;sample node is a node of the content type&nbsp;<em>Resource</em>.</p><p>{sample content}</p>'
format: basic_html
summary: ''
field_issue_date:
-
value: '2023-05-15T01:56:46'
\ No newline at end of file
name: Sector Resource
type: module
description: Provides the default content and configuration for Resource content type
package: Sector
core_version_requirement: ^10
dependencies:
- sector:sector_media
- sector:sector_text_formats
- schema_metatag:schema_metatag
- drupal:menu_link_content
- default_content:default_content
default_content:
node:
- c1cbb0e6-0bbd-4ea7-b1b0-8a1f290f7bbb
- 5d52aa52-3100-4fba-b937-2079f24b8690
menu_link_content:
- 0654d01d-264f-4520-b823-163c7cefd722
\ No newline at end of file
<?php
/**
* @file
* Install, update and uninstall functions for the profilename install profile.
*/
use Drupal\user\Entity\Role;
use Drupal\Core\Entity\EntityInterface;
/*
* Implements hook_install()
*/
function sector_resource_install() {
\Drupal::service('module_installer')->install([
'schema_article',
'metatag_twitter_cards'
], FALSE);
$role_object = Role::load('content_editor');
$role_object->grantPermission('create sector_resource content');
$role_object->grantPermission('delete own sector_resource content');
$role_object->grantPermission('delete sector_resource revisions');
$role_object->grantPermission('edit own sector_resource content');
$role_object->save();
}
/*
* Implements hook_uninstall()
*/
function sector_resource_uninstall() {
// Delete all nodes of given content type.
$storage_handler = \Drupal::entityTypeManager()->getStorage('node');
$nodes = $storage_handler->loadByProperties(['type' => 'sector_resource']);
$storage_handler->delete($nodes);
// Delete view
\Drupal::service('config.factory')->getEditable('views.view.sector_resource')->delete();
// delete menu item
$menu_link_content = \Drupal::service('entity.repository')->loadEntityByUuid('menu_link_content', '0654d01d-264f-4520-b823-163c7cefd722');
if($menu_link_content) {
$menu_link_content->delete();
}
// delete view page
$view_page = \Drupal::service('entity.repository')->loadEntityByUuid('node', '5d52aa52-3100-4fba-b937-2079f24b8690');
if($view_page) {
$view_page->delete();
}
// Delete content type.
$content_type = \Drupal::entityTypeManager()->getStorage('node_type')->load('sector_resource');
$content_type->delete();
}
/**
* Implements hook_ENTITY_TYPE_insert() for node entities.
*/
function sector_resource_node_insert(EntityInterface $entity) {
switch ($entity->uuid()) {
case '5d52aa52-3100-4fba-b937-2079f24b8690':
$block = Drupal\block\Entity\Block::load('views_block__sector_resources_block_default');
if(!$block) {
return;
}
$block->setVisibilityConfig('request_path', array('id' => 'request_path',
'pages'=> '/node/' . $entity->id(),
'negate' => false,
)
);
$block->save();
\Drupal::logger('sector_resource')->notice('Setting views_block__sector_resources_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