Skip to content
Snippets Groups Projects
Commit b5c1d6eb authored by Kevin Paxman's avatar Kevin Paxman
Browse files

Merge branch '8.x-1.x' into feature/ISTWCMS-4103-ebremner-add-metatag-fields

parents 7412261d 39d8ede1
No related branches found
No related tags found
1 merge request!2ISTWCMS-4103: adding field storage for meta tags fields
Showing
with 530 additions and 54 deletions
langcode: en
status: true
dependencies:
config:
- taxonomy.vocabulary.uw_vocab_audience
module:
- text
id: taxonomy_term.uw_vocab_audience.default
targetEntityType: taxonomy_term
bundle: uw_vocab_audience
mode: default
content:
description:
type: text_textarea
weight: 1
region: content
settings:
placeholder: ''
rows: 5
third_party_settings: { }
langcode:
type: language_select
weight: 2
region: content
settings:
include_locked: true
third_party_settings: { }
name:
type: string_textfield
weight: 0
region: content
settings:
size: 60
placeholder: ''
third_party_settings: { }
status:
type: boolean_checkbox
settings:
display_label: true
weight: 3
region: content
third_party_settings: { }
hidden:
path: true
...@@ -35,7 +35,8 @@ blocks: ...@@ -35,7 +35,8 @@ blocks:
weight: 0 weight: 0
image_path: /profiles/uw_base_profile/themes/uw_fdsu_theme_resp/images/layout_builder_browser/fullwidthimage.svg image_path: /profiles/uw_base_profile/themes/uw_fdsu_theme_resp/images/layout_builder_browser/fullwidthimage.svg
image_alt: '' image_alt: ''
- block_id: 'inline_block:uw_cbl_image_gallery' -
block_id: 'inline_block:uw_cbl_image_gallery'
weight: 0 weight: 0
image_path: /profiles/uw_base_profile/themes/uw_fdsu_theme_resp/images/layout_builder_browser/imagegallery.svg image_path: /profiles/uw_base_profile/themes/uw_fdsu_theme_resp/images/layout_builder_browser/imagegallery.svg
image_alt: '' image_alt: ''
...@@ -49,3 +50,8 @@ blocks: ...@@ -49,3 +50,8 @@ blocks:
weight: 0 weight: 0
image_path: /profiles/uw_base_profile/themes/uw_fdsu_theme_resp/images/layout_builder_browser/relatedlinks.svg image_path: /profiles/uw_base_profile/themes/uw_fdsu_theme_resp/images/layout_builder_browser/relatedlinks.svg
image_alt: '' image_alt: ''
-
block_id: 'inline_block:uw_cbl_timeline'
weight: 0
image_path: /profiles/uw_base_profile/themes/uw_fdsu_theme_resp/images/layout_builder_browser/timeline.svg
image_alt: ''
...@@ -30,3 +30,13 @@ blocks: ...@@ -30,3 +30,13 @@ blocks:
weight: 0 weight: 0
image_path: /profiles/uw_base_profile/themes/uw_fdsu_theme_resp/images/layout_builder_browser/twitter.svg image_path: /profiles/uw_base_profile/themes/uw_fdsu_theme_resp/images/layout_builder_browser/twitter.svg
image_alt: '' image_alt: ''
-
block_id: 'inline_block:uw_cbl_powerbi'
weight: 0
image_path: /profiles/uw_base_profile/themes/uw_fdsu_theme_resp/images/layout_builder_browser/powerbi.svg
image_alt: ''
-
block_id: 'inline_block:uw_cbl_google_maps'
weight: 0
image_path: /profiles/uw_base_profile/themes/uw_fdsu_theme_resp/images/layout_builder_browser/maps_google.svg
image_alt: ''
entity_type_groups:
node:
uw_ct_blog:
basic: basic
advanced: advanced
open_graph: open_graph
twitter_cards: twitter_cards
schema_article: schema_article
uw_ct_event:
basic: basic
advanced: advanced
open_graph: open_graph
twitter_cards: twitter_cards
schema_event: schema_event
uw_ct_news_item:
basic: basic
advanced: advanced
open_graph: open_graph
twitter_cards: twitter_cards
schema_article: schema_article
uw_ct_web_page:
basic: basic
advanced: advanced
open_graph: open_graph
twitter_cards: twitter_cards
schema_web_page: schema_web_page
...@@ -21,3 +21,4 @@ permissions: ...@@ -21,3 +21,4 @@ permissions:
- 'view paragraph content uw_para_fact_text' - 'view paragraph content uw_para_fact_text'
- 'view paragraph content uw_para_facts_and_figures' - 'view paragraph content uw_para_facts_and_figures'
- 'view paragraph content uw_para_ff' - 'view paragraph content uw_para_ff'
- 'view paragraph content uw_para_timeline'
...@@ -24,4 +24,5 @@ permissions: ...@@ -24,4 +24,5 @@ permissions:
- 'view paragraph content uw_para_fact_text' - 'view paragraph content uw_para_fact_text'
- 'view paragraph content uw_para_facts_and_figures' - 'view paragraph content uw_para_facts_and_figures'
- 'view paragraph content uw_para_ff' - 'view paragraph content uw_para_ff'
- 'view paragraph content uw_para_timeline'
- 'view the administration theme' - 'view the administration theme'
...@@ -38,6 +38,7 @@ permissions: ...@@ -38,6 +38,7 @@ permissions:
- 'create paragraph content uw_para_fact_text' - 'create paragraph content uw_para_fact_text'
- 'create paragraph content uw_para_facts_and_figures' - 'create paragraph content uw_para_facts_and_figures'
- 'create paragraph content uw_para_ff' - 'create paragraph content uw_para_ff'
- 'create paragraph content uw_para_timeline'
- 'create terms in uw_tax_event_tags' - 'create terms in uw_tax_event_tags'
- 'create terms in uw_tax_event_type' - 'create terms in uw_tax_event_type'
- 'create terms in uw_vocab_audience' - 'create terms in uw_vocab_audience'
...@@ -47,6 +48,7 @@ permissions: ...@@ -47,6 +48,7 @@ permissions:
- 'create terms in uw_vocab_news_tags' - 'create terms in uw_vocab_news_tags'
- 'create url aliases' - 'create url aliases'
- 'create uw_ct_blog content' - 'create uw_ct_blog content'
- 'create uw_ct_catalog_item content'
- 'create uw_ct_event content' - 'create uw_ct_event content'
- 'create uw_ct_news_item content' - 'create uw_ct_news_item content'
- 'create uw_ct_sidebar content' - 'create uw_ct_sidebar content'
...@@ -62,13 +64,16 @@ permissions: ...@@ -62,13 +64,16 @@ permissions:
- 'delete paragraph content uw_para_fact_text' - 'delete paragraph content uw_para_fact_text'
- 'delete paragraph content uw_para_facts_and_figures' - 'delete paragraph content uw_para_facts_and_figures'
- 'delete paragraph content uw_para_ff' - 'delete paragraph content uw_para_ff'
- 'delete paragraph content uw_para_timeline'
- 'edit any uw_ct_blog content' - 'edit any uw_ct_blog content'
- 'edit any uw_ct_catalog_item content'
- 'edit any uw_ct_event content' - 'edit any uw_ct_event content'
- 'edit any uw_ct_news_item content' - 'edit any uw_ct_news_item content'
- 'edit any uw_ct_sidebar content' - 'edit any uw_ct_sidebar content'
- 'edit any uw_ct_site_footer content' - 'edit any uw_ct_site_footer content'
- 'edit any uw_ct_web_page content' - 'edit any uw_ct_web_page content'
- 'edit own uw_ct_blog content' - 'edit own uw_ct_blog content'
- 'edit own uw_ct_catalog_item content'
- 'edit own uw_ct_event content' - 'edit own uw_ct_event content'
- 'edit own uw_ct_news_item content' - 'edit own uw_ct_news_item content'
- 'edit own uw_ct_sidebar content' - 'edit own uw_ct_sidebar content'
...@@ -85,6 +90,7 @@ permissions: ...@@ -85,6 +90,7 @@ permissions:
- 'make smart dates recur' - 'make smart dates recur'
- 'reschedule smart date recur instances' - 'reschedule smart date recur instances'
- 'revert uw_ct_blog revisions' - 'revert uw_ct_blog revisions'
- 'revert uw_ct_catalog_item revisions'
- 'revert uw_ct_event revisions' - 'revert uw_ct_event revisions'
- 'revert uw_ct_news_item revisions' - 'revert uw_ct_news_item revisions'
- 'revert uw_ct_sidebar revisions' - 'revert uw_ct_sidebar revisions'
...@@ -99,6 +105,7 @@ permissions: ...@@ -99,6 +105,7 @@ permissions:
- 'update paragraph content uw_para_fact_text' - 'update paragraph content uw_para_fact_text'
- 'update paragraph content uw_para_facts_and_figures' - 'update paragraph content uw_para_facts_and_figures'
- 'update paragraph content uw_para_ff' - 'update paragraph content uw_para_ff'
- 'update paragraph content uw_para_timeline'
- 'use uw_workflow transition needs_review' - 'use uw_workflow transition needs_review'
- 'use workbench access' - 'use workbench access'
- 'view all media revisions' - 'view all media revisions'
...@@ -109,6 +116,7 @@ permissions: ...@@ -109,6 +116,7 @@ permissions:
- 'view own unpublished media' - 'view own unpublished media'
- 'view unpublished paragraphs' - 'view unpublished paragraphs'
- 'view uw_ct_blog revisions' - 'view uw_ct_blog revisions'
- 'view uw_ct_catalog_item revisions'
- 'view uw_ct_event revisions' - 'view uw_ct_event revisions'
- 'view uw_ct_news_item revisions' - 'view uw_ct_news_item revisions'
- 'view uw_ct_sidebar revisions' - 'view uw_ct_sidebar revisions'
......
...@@ -39,6 +39,7 @@ permissions: ...@@ -39,6 +39,7 @@ permissions:
- 'create paragraph content uw_para_fact_text' - 'create paragraph content uw_para_fact_text'
- 'create paragraph content uw_para_facts_and_figures' - 'create paragraph content uw_para_facts_and_figures'
- 'create paragraph content uw_para_ff' - 'create paragraph content uw_para_ff'
- 'create paragraph content uw_para_timeline'
- 'create terms in uw_tax_event_tags' - 'create terms in uw_tax_event_tags'
- 'create terms in uw_tax_event_type' - 'create terms in uw_tax_event_type'
- 'create terms in uw_vocab_audience' - 'create terms in uw_vocab_audience'
...@@ -48,6 +49,7 @@ permissions: ...@@ -48,6 +49,7 @@ permissions:
- 'create terms in uw_vocab_news_tags' - 'create terms in uw_vocab_news_tags'
- 'create url aliases' - 'create url aliases'
- 'create uw_ct_blog content' - 'create uw_ct_blog content'
- 'create uw_ct_catalog_item content'
- 'create uw_ct_event content' - 'create uw_ct_event content'
- 'create uw_ct_news_item content' - 'create uw_ct_news_item content'
- 'create uw_ct_sidebar content' - 'create uw_ct_sidebar content'
...@@ -63,13 +65,16 @@ permissions: ...@@ -63,13 +65,16 @@ permissions:
- 'delete paragraph content uw_para_fact_text' - 'delete paragraph content uw_para_fact_text'
- 'delete paragraph content uw_para_facts_and_figures' - 'delete paragraph content uw_para_facts_and_figures'
- 'delete paragraph content uw_para_ff' - 'delete paragraph content uw_para_ff'
- 'delete paragraph content uw_para_timeline'
- 'edit any uw_ct_blog content' - 'edit any uw_ct_blog content'
- 'edit any uw_ct_catalog_item content'
- 'edit any uw_ct_event content' - 'edit any uw_ct_event content'
- 'edit any uw_ct_news_item content' - 'edit any uw_ct_news_item content'
- 'edit any uw_ct_sidebar content' - 'edit any uw_ct_sidebar content'
- 'edit any uw_ct_site_footer content' - 'edit any uw_ct_site_footer content'
- 'edit any uw_ct_web_page content' - 'edit any uw_ct_web_page content'
- 'edit own uw_ct_blog content' - 'edit own uw_ct_blog content'
- 'edit own uw_ct_catalog_item content'
- 'edit own uw_ct_event content' - 'edit own uw_ct_event content'
- 'edit own uw_ct_news_item content' - 'edit own uw_ct_news_item content'
- 'edit own uw_ct_sidebar content' - 'edit own uw_ct_sidebar content'
...@@ -86,6 +91,7 @@ permissions: ...@@ -86,6 +91,7 @@ permissions:
- 'make smart dates recur' - 'make smart dates recur'
- 'reschedule smart date recur instances' - 'reschedule smart date recur instances'
- 'revert uw_ct_blog revisions' - 'revert uw_ct_blog revisions'
- 'revert uw_ct_catalog_item revisions'
- 'revert uw_ct_event revisions' - 'revert uw_ct_event revisions'
- 'revert uw_ct_news_item revisions' - 'revert uw_ct_news_item revisions'
- 'revert uw_ct_sidebar revisions' - 'revert uw_ct_sidebar revisions'
...@@ -100,6 +106,7 @@ permissions: ...@@ -100,6 +106,7 @@ permissions:
- 'update paragraph content uw_para_fact_text' - 'update paragraph content uw_para_fact_text'
- 'update paragraph content uw_para_facts_and_figures' - 'update paragraph content uw_para_facts_and_figures'
- 'update paragraph content uw_para_ff' - 'update paragraph content uw_para_ff'
- 'update paragraph content uw_para_timeline'
- 'use uw_workflow transition archived' - 'use uw_workflow transition archived'
- 'use uw_workflow transition draft' - 'use uw_workflow transition draft'
- 'use uw_workflow transition needs_review' - 'use uw_workflow transition needs_review'
...@@ -113,6 +120,7 @@ permissions: ...@@ -113,6 +120,7 @@ permissions:
- 'view own unpublished media' - 'view own unpublished media'
- 'view unpublished paragraphs' - 'view unpublished paragraphs'
- 'view uw_ct_blog revisions' - 'view uw_ct_blog revisions'
- 'view uw_ct_catalog_item revisions'
- 'view uw_ct_event revisions' - 'view uw_ct_event revisions'
- 'view uw_ct_news_item revisions' - 'view uw_ct_news_item revisions'
- 'view uw_ct_sidebar revisions' - 'view uw_ct_sidebar revisions'
......
...@@ -40,6 +40,7 @@ permissions: ...@@ -40,6 +40,7 @@ permissions:
- 'create paragraph content uw_para_fact_text' - 'create paragraph content uw_para_fact_text'
- 'create paragraph content uw_para_facts_and_figures' - 'create paragraph content uw_para_facts_and_figures'
- 'create paragraph content uw_para_ff' - 'create paragraph content uw_para_ff'
- 'create paragraph content uw_para_timeline'
- 'create terms in uw_tax_event_tags' - 'create terms in uw_tax_event_tags'
- 'create terms in uw_tax_event_type' - 'create terms in uw_tax_event_type'
- 'create terms in uw_vocab_audience' - 'create terms in uw_vocab_audience'
...@@ -49,6 +50,7 @@ permissions: ...@@ -49,6 +50,7 @@ permissions:
- 'create terms in uw_vocab_news_tags' - 'create terms in uw_vocab_news_tags'
- 'create url aliases' - 'create url aliases'
- 'create uw_ct_blog content' - 'create uw_ct_blog content'
- 'create uw_ct_catalog_item content'
- 'create uw_ct_event content' - 'create uw_ct_event content'
- 'create uw_ct_news_item content' - 'create uw_ct_news_item content'
- 'create uw_ct_sidebar content' - 'create uw_ct_sidebar content'
...@@ -58,6 +60,7 @@ permissions: ...@@ -58,6 +60,7 @@ permissions:
- 'delete all revisions' - 'delete all revisions'
- 'delete any media' - 'delete any media'
- 'delete any uw_ct_blog content' - 'delete any uw_ct_blog content'
- 'delete any uw_ct_catalog_item content'
- 'delete any uw_ct_event content' - 'delete any uw_ct_event content'
- 'delete any uw_ct_news_item content' - 'delete any uw_ct_news_item content'
- 'delete any uw_ct_sidebar content' - 'delete any uw_ct_sidebar content'
...@@ -66,6 +69,7 @@ permissions: ...@@ -66,6 +69,7 @@ permissions:
- 'delete any uw_news_item content' - 'delete any uw_news_item content'
- 'delete orphan revisions' - 'delete orphan revisions'
- 'delete own uw_ct_blog content' - 'delete own uw_ct_blog content'
- 'delete own uw_ct_catalog_item content'
- 'delete own uw_ct_event content' - 'delete own uw_ct_event content'
- 'delete own uw_ct_news_item content' - 'delete own uw_ct_news_item content'
- 'delete own uw_ct_sidebar content' - 'delete own uw_ct_sidebar content'
...@@ -80,6 +84,7 @@ permissions: ...@@ -80,6 +84,7 @@ permissions:
- 'delete paragraph content uw_para_fact_text' - 'delete paragraph content uw_para_fact_text'
- 'delete paragraph content uw_para_facts_and_figures' - 'delete paragraph content uw_para_facts_and_figures'
- 'delete paragraph content uw_para_ff' - 'delete paragraph content uw_para_ff'
- 'delete paragraph content uw_para_timeline'
- 'delete terms in uw_tax_event_tags' - 'delete terms in uw_tax_event_tags'
- 'delete terms in uw_tax_event_type' - 'delete terms in uw_tax_event_type'
- 'delete terms in uw_vocab_audience' - 'delete terms in uw_vocab_audience'
...@@ -89,6 +94,7 @@ permissions: ...@@ -89,6 +94,7 @@ permissions:
- 'delete terms in uw_vocab_news_tags' - 'delete terms in uw_vocab_news_tags'
- 'delete uw_news_item revisions' - 'delete uw_news_item revisions'
- 'edit any uw_ct_blog content' - 'edit any uw_ct_blog content'
- 'edit any uw_ct_catalog_item content'
- 'edit any uw_ct_event content' - 'edit any uw_ct_event content'
- 'edit any uw_ct_news_item content' - 'edit any uw_ct_news_item content'
- 'edit any uw_ct_sidebar content' - 'edit any uw_ct_sidebar content'
...@@ -96,6 +102,7 @@ permissions: ...@@ -96,6 +102,7 @@ permissions:
- 'edit any uw_ct_web_page content' - 'edit any uw_ct_web_page content'
- 'edit any uw_news_item content' - 'edit any uw_news_item content'
- 'edit own uw_ct_blog content' - 'edit own uw_ct_blog content'
- 'edit own uw_ct_catalog_item content'
- 'edit own uw_ct_event content' - 'edit own uw_ct_event content'
- 'edit own uw_ct_news_item content' - 'edit own uw_ct_news_item content'
- 'edit own uw_ct_sidebar content' - 'edit own uw_ct_sidebar content'
...@@ -113,6 +120,7 @@ permissions: ...@@ -113,6 +120,7 @@ permissions:
- 'reschedule smart date recur instances' - 'reschedule smart date recur instances'
- 'revert all revisions' - 'revert all revisions'
- 'revert uw_ct_blog revisions' - 'revert uw_ct_blog revisions'
- 'revert uw_ct_catalog_item revisions'
- 'revert uw_ct_event revisions' - 'revert uw_ct_event revisions'
- 'revert uw_ct_news_item revisions' - 'revert uw_ct_news_item revisions'
- 'revert uw_ct_sidebar revisions' - 'revert uw_ct_sidebar revisions'
...@@ -128,6 +136,7 @@ permissions: ...@@ -128,6 +136,7 @@ permissions:
- 'update paragraph content uw_para_fact_text' - 'update paragraph content uw_para_fact_text'
- 'update paragraph content uw_para_facts_and_figures' - 'update paragraph content uw_para_facts_and_figures'
- 'update paragraph content uw_para_ff' - 'update paragraph content uw_para_ff'
- 'update paragraph content uw_para_timeline'
- 'use uw_workflow transition archived' - 'use uw_workflow transition archived'
- 'use uw_workflow transition draft' - 'use uw_workflow transition draft'
- 'use uw_workflow transition needs_review' - 'use uw_workflow transition needs_review'
...@@ -141,6 +150,7 @@ permissions: ...@@ -141,6 +150,7 @@ permissions:
- 'view own unpublished media' - 'view own unpublished media'
- 'view unpublished paragraphs' - 'view unpublished paragraphs'
- 'view uw_ct_blog revisions' - 'view uw_ct_blog revisions'
- 'view uw_ct_catalog_item revisions'
- 'view uw_ct_event revisions' - 'view uw_ct_event revisions'
- 'view uw_ct_news_item revisions' - 'view uw_ct_news_item revisions'
- 'view uw_ct_sidebar revisions' - 'view uw_ct_sidebar revisions'
......
...@@ -43,4 +43,4 @@ ...@@ -43,4 +43,4 @@
box-shadow: none; box-shadow: none;
border: 1px solid #bfbfba; border: 1px solid #bfbfba;
padding: 1rem; padding: 1rem;
} }
\ No newline at end of file
...@@ -17,7 +17,7 @@ class UwNodeAccessCheck implements AccessInterface { ...@@ -17,7 +17,7 @@ class UwNodeAccessCheck implements AccessInterface {
* A custom access check. * A custom access check.
* *
* @param \Drupal\Core\Routing\RouteMatchInterface $route_match * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
* * Route matching.
* @param \Drupal\Core\Session\AccountInterface $account * @param \Drupal\Core\Session\AccountInterface $account
* Run access checks for this account. * Run access checks for this account.
* *
...@@ -29,22 +29,26 @@ class UwNodeAccessCheck implements AccessInterface { ...@@ -29,22 +29,26 @@ class UwNodeAccessCheck implements AccessInterface {
// Get the node object, which is in the route match variable. // Get the node object, which is in the route match variable.
$node = $route_match->getParameter('node'); $node = $route_match->getParameter('node');
// Check if this is a sidebar content type and if the user has permission to edit the content type. // Check if this is a sidebar content type and if the user has permission
// We want to throw a 404 (NotFoundHttpException) if they do not have access. This is the case when // to edit the content type. We want to throw a 404 (NotFoundHttpException)
// a user is not logged in, and when they do not have permission to edit it. // if they do not have access. This is the case when a user is not logged
// in, and when they do not have permission to edit it.
if ($node && $node->bundle() == 'uw_ct_sidebar' && !$account->hasPermission('edit any uw_ct_sidebar content')) { if ($node && $node->bundle() == 'uw_ct_sidebar' && !$account->hasPermission('edit any uw_ct_sidebar content')) {
throw new NotFoundHttpException(); throw new NotFoundHttpException();
} }
// Check if this is a sidebar content type and if the user has permission to edit the content type. // Check if this is a sidebar content type and if the user has permission
// We want to throw a 404 (NotFoundHttpException) if they do not have access. This is the case when // to edit the content type. We want to throw a 404 (NotFoundHttpException)
// a user is not logged in, and when they do not have permission to edit it. // if they do not have access. This is the case when a user is not logged
// in, and when they do not have permission to edit it.
if ($node && $node->bundle() == 'uw_ct_site_footer' && !$account->hasPermission('edit any uw_ct_site_footer content')) { if ($node && $node->bundle() == 'uw_ct_site_footer' && !$account->hasPermission('edit any uw_ct_site_footer content')) {
throw new NotFoundHttpException(); throw new NotFoundHttpException();
} }
// We have to return some type of access, so we are going to return allowed, if they do not have access, // We have to return some type of access, so we are going to return
// the new exception is going to be thrown above. // allowed, if they do not have access, the new exception is going to be
// thrown above.
return AccessResult::allowed(); return AccessResult::allowed();
} }
} }
<?php
namespace Drupal\uw_cfg_common\Form;
use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\Core\Form\ConfirmFormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Url;
use Symfony\Component\DependencyInjection\ContainerInterface;
/**
* Form class for the content access form.
*/
class UwContentModerationForm extends ConfirmFormBase {
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* The nid (node id).
*
* @var int
*/
protected $nid;
/**
* The vid (version id).
*
* @var int
*/
protected $vid;
/**
* Class constructor.
*
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* The entity type manager.
*/
public function __construct(EntityTypeManagerInterface $entity_type_manager) {
$this->entityTypeManager = $entity_type_manager;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
// Instantiates this form class.
return new static(
$container->get('entity_type.manager')
);
}
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'uw_content_moderation_form';
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state, $nid = NULL, $vid = NULL) {
// Set the node and version ids.
$this->nid = $nid;
$this->vid = $vid;
// Return the form from the parent (confirm form).
return parent::buildForm($form, $form_state);
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
// Set the options for the URL.
$options = ['absolute' => TRUE];
// Return the URL back to the node.
$url = Url::fromRoute('entity.node.canonical', ['node' => $this->nid], $options);
// Adding the redirect back to the node.
$form_state->setRedirectUrl($url);
// Set the message that the permissions have been saved.
$this->messenger()->addStatus($this->t('There is still work to be done to unpublish, but we made it here.'));
}
/**
* Returns the question to ask the user.
*
* @return \Drupal\Core\StringTranslation\TranslatableMarkup
* The form question. The page title will be set to this value.
*/
public function getQuestion() {
// Get the node object.
$node = $this->entityTypeManager->getStorage('node')->load($this->nid);
// Return the question to see if they want to publish the node.
return $this->t('Are you sure you want to unpublish %node_title?', ['%node_title' => $node->getTitle()]);
}
/**
* Returns the route to go to if the user cancels the action.
*
* @return \Drupal\Core\Url
* A URL object.
*/
public function getCancelUrl() {
// Set the options for the URL.
$options = ['absolute' => TRUE];
// Return the URL back to the node.
return Url::fromRoute('entity.node.canonical', ['node' => $this->nid], $options);
}
}
...@@ -34,4 +34,5 @@ class Uw2ColumnLayout extends UwColumnLayoutBase { ...@@ -34,4 +34,5 @@ class Uw2ColumnLayout extends UwColumnLayoutBase {
return $form; return $form;
} }
} }
...@@ -37,4 +37,5 @@ class Uw3ColumnLayout extends UwColumnLayoutBase { ...@@ -37,4 +37,5 @@ class Uw3ColumnLayout extends UwColumnLayoutBase {
return $form; return $form;
} }
} }
...@@ -37,4 +37,5 @@ class Uw4ColumnLayout extends UwColumnLayoutBase { ...@@ -37,4 +37,5 @@ class Uw4ColumnLayout extends UwColumnLayoutBase {
return $form; return $form;
} }
} }
...@@ -17,7 +17,10 @@ class UwColumnLayoutBase extends LayoutDefault implements PluginFormInterface { ...@@ -17,7 +17,10 @@ class UwColumnLayoutBase extends LayoutDefault implements PluginFormInterface {
public function submitConfigurationForm(array &$form, FormStateInterface $form_state) { public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
// Set the column class in the config. // Set the column class in the config.
$this->configuration['column_class'] = $form_state->getValue(['layout_settings', 'column_class'], NULL); $this->configuration['column_class'] = $form_state->getValue(
['layout_settings', 'column_class'],
NULL
);
} }
/** /**
......
<?php <?php
namespace Drupal\uw_cfg_common\Routing; namespace Drupal\uw_cfg_common\Routing;
use Drupal\Core\Routing\RouteSubscriberBase; use Drupal\Core\Routing\RouteSubscriberBase;
use Symfony\Component\Routing\RouteCollection; use Symfony\Component\Routing\RouteCollection;
/** /**
* Listens to the dynamic route events. * Listens to the dynamic route events.
*/ */
class UwNodeAccessRouteSubscriber extends RouteSubscriberBase { class UwNodeAccessRouteSubscriber extends RouteSubscriberBase {
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
protected function alterRoutes(RouteCollection $collection) { protected function alterRoutes(RouteCollection $collection) {
// Change the route associated with node (/node/{nid}). // Change the route associated with node (/node/{nid}).
if ($route = $collection->get('entity.node.canonical')) { if ($route = $collection->get('entity.node.canonical')) {
$route->setRequirement('_custom_access', 'Drupal\uw_cfg_common\Access\UwNodeAccessCheck::access'); $route->setRequirement('_custom_access', 'Drupal\uw_cfg_common\Access\UwNodeAccessCheck::access');
} }
} }
} }
\ No newline at end of file
...@@ -3,16 +3,46 @@ ...@@ -3,16 +3,46 @@
namespace Drupal\uw_cfg_common\Service; namespace Drupal\uw_cfg_common\Service;
use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\EntityInterface;
use Drupal\node\Entity\Node; use Drupal\Core\Entity\EntityTypeManagerInterface;
use Drupal\node\NodeInterface; use Drupal\node\NodeInterface;
use Drupal\Core\Database\Connection;
/** /**
* Class UWService * Class UWService.
*
* UW Service that holds common functionality used by uw blocks.
* *
* @package Drupal\uw_cfg_common\Service * @package Drupal\uw_cfg_common\Service
*/ */
class UWService implements UWServiceInterface { class UWService implements UWServiceInterface {
/**
* Entity type manager from core.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
private $entityTypeManager;
/**
* Database connection.
*
* @var \Drupal\Core\Database\Connection
*/
private $database;
/**
* Default constructor.
*
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entityTypeManager
* Entity Type Manager from core.
* @param \Drupal\Core\Database\Connection $database
* The database entity.
*/
public function __construct(EntityTypeManagerInterface $entityTypeManager, Connection $database) {
$this->entityTypeManager = $entityTypeManager;
$this->database = $database;
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
...@@ -157,4 +187,76 @@ class UWService implements UWServiceInterface { ...@@ -157,4 +187,76 @@ class UWService implements UWServiceInterface {
return $variables; return $variables;
} }
/**
* {@inheritDoc}
*/
public function getOrCheckAttachedSidebar(int $attached_page_nid, int $sidebar_nid = NULL, string $type = NULL): int {
// A database called to get the field with the condition of the
// attached_page_nid.
$result = $this->database
->select('node__field_uw_attach_page', 'nfuap')
->fields('nfuap', ['entity_id', 'field_uw_attach_page_target_id'])
->condition('field_uw_attach_page_target_id', $attached_page_nid);
// If we are doing a a check for sidebar, then add the condition
// that it is not equal to the current sidebar_nid that we are on.
// Meaning that we are checking for any other sidebars that this
// attached_page_nid is attached to.
if ($type == 'check') {
// Add the not equals to condition.
$result->condition('entity_id', $sidebar_nid, '<>');
}
// Get the results of query, we only need to fetch, because we are
// only every expecting one sidebar only has one other node page
// attached.
$results = $result->execute()->fetch();
// If we have results, then return the entity_id, which is the
// sidebar_nid that the attached_page_nid is attached to.
if (isset($results->entity_id)) {
// Return the entity_id.
return $results->entity_id;
}
// If we made it here, there are no other sidebars that the
// attached_page_nid is attached to, so we can simply return 0.
else {
return 0;
}
}
/**
* {@inheritDoc}
*/
public function getUwContentTypes($with_sidebar = FALSE): array {
$return_content_types = [];
// This is the list of all UW content types, with a TRUE/FALSE, indicating
// whether or not a sidebar can be attached to this content type.
$content_types = [
'uw_ct_blog' => TRUE,
'uw_ct_catalog_item' => FALSE,
'uw_ct_event' => TRUE,
'uw_ct_news_item' => TRUE,
'uw_ct_sidebar' => FALSE,
'uw_ct_site_footer' => FALSE,
'uw_ct_web_page' => TRUE,
];
foreach ($content_types as $key => $value) {
if ($with_sidebar && $value) {
$return_content_types[] = $key;
}
elseif (!$with_sidebar) {
$return_content_types[] = $key;
}
}
return $return_content_types;
}
} }
...@@ -6,9 +6,9 @@ use Drupal\Core\Entity\EntityInterface; ...@@ -6,9 +6,9 @@ use Drupal\Core\Entity\EntityInterface;
use Drupal\node\NodeInterface; use Drupal\node\NodeInterface;
/** /**
* Interface UWServiceInterface * Interface UWServiceInterface.
* *
* Interface that is collection of common functions used throughout custom blocks. * Interface that is collection of common functions used in custom blocks.
* *
* @package Drupal\uw_cfg_common\Service * @package Drupal\uw_cfg_common\Service
*/ */
...@@ -41,4 +41,46 @@ interface UWServiceInterface { ...@@ -41,4 +41,46 @@ interface UWServiceInterface {
* Array of variables and their values. * Array of variables and their values.
*/ */
public function getTeaserContent(NodeInterface $node, array $variables_to_get, string $teaser_type): array; public function getTeaserContent(NodeInterface $node, array $variables_to_get, string $teaser_type): array;
/**
* A function to get or check the attached sidebar.
*
* If the type is set to check, then the function will return one
* of two things. It will either return a 0, which means that the
* attached_page_nid is not attached to any other sidebar in the
* system. Or it will return the entity_id of the sidebar (sidebar_nid)
* that it is currently attached to.
*
* For example:
* If the attached_page_nid is 3 and the sidebar_nid is 7, and
* the query finds that 3 is already attached to sidebar_nid 6, then 6
* will be returned.
*
* If the attached_page_nid is 3 and the sidebar_nid is 7, and
* the query finds no other sidebar_nids that 3 is attached to, then 0
* will be returned.
*
* @param int $attached_page_nid
* An integer value that represents the nid of the page to be attached to.
* @param int|null $sidebar_nid
* An integer value that represents the nid of the current sidebar.
* @param string|null $type
* A string value that represents either "get" or "check".
*
* @return int
* A value that is either 0 (no nids) or the entity_id of a sidebar.
*/
public function getOrCheckAttachedSidebar(int $attached_page_nid, int $sidebar_nid = NULL, string $type = NULL): int;
/**
* A function to get an array of UW content types, with or without sidebar.
*
* @param bool $with_sidebar
* A boolean to state if we want content types that can have sidebars.
*
* @return array
* An array of the machine names of the UW content types.
*/
public function getUwContentTypes(bool $with_sidebar = FALSE): array;
} }
...@@ -6,6 +6,8 @@ use Drupal\user\Entity\Role; ...@@ -6,6 +6,8 @@ use Drupal\user\Entity\Role;
/** /**
* Class UwPermissions. * Class UwPermissions.
*
* UW Specific permissions.
*/ */
class UwPermissions { class UwPermissions {
...@@ -54,54 +56,135 @@ class UwPermissions { ...@@ -54,54 +56,135 @@ class UwPermissions {
// Blog permissions. // Blog permissions.
'Blog' => [ 'Blog' => [
'Use content type' => 'Use content type' =>
UwPermissions::buildRolePermissionsListContentType('uw_ct_blog'), UwPermissions::buildRolePermissionsListContentType(
'uw_ct_blog'
),
'Create/edit tags' => 'Create/edit tags' =>
UwPermissions::buildRolePermissionsListTaxonomyTerm('uw_vocab_blog_tags', ['create', 'edit']), UwPermissions::buildRolePermissionsListTaxonomyTerm(
'uw_vocab_blog_tags',
['create', 'edit']
),
'Delete tags' => 'Delete tags' =>
UwPermissions::buildRolePermissionsListTaxonomyTerm('uw_vocab_blog_tags', ['delete']), UwPermissions::buildRolePermissionsListTaxonomyTerm(
'uw_vocab_blog_tags',
['delete']
),
],
// Catalog permissions.
'Catalog' => [
'Use content type' =>
UwPermissions::buildRolePermissionsListContentType(
'uw_ct_catalog_item'
),
'Create/edit audience' =>
UwPermissions::buildRolePermissionsListTaxonomyTerm(
'uw_vocab_audience',
['create', 'edit']
),
'Delete audience' =>
UwPermissions::buildRolePermissionsListTaxonomyTerm(
'uw_vocab_audience',
['delete']
),
'Create/edit categories' =>
UwPermissions::buildRolePermissionsListTaxonomyTerm(
'uw_vocab_catalog_categories',
['create', 'edit']
),
'Delete categories' =>
UwPermissions::buildRolePermissionsListTaxonomyTerm(
'uw_vocab_catalog_categories',
['delete']
),
'Create/edit catalogs' =>
UwPermissions::buildRolePermissionsListTaxonomyTerm(
'uw_vocab_catalogs',
['create', 'edit']
),
'Delete catalogs' =>
UwPermissions::buildRolePermissionsListTaxonomyTerm(
'uw_vocab_catalogs',
['delete']
),
], ],
// Event permissions. // Event permissions.
'Event' => [ 'Event' => [
'Use content type' => UwPermissions::buildRolePermissionsListContentType('uw_ct_event'), 'Use content type' =>
'Create/edit tags' => UwPermissions::buildRolePermissionsListTaxonomyTerm('uw_tax_event_tags', ['create', 'edit']), UwPermissions::buildRolePermissionsListContentType(
'Delete tags' => UwPermissions::buildRolePermissionsListTaxonomyTerm('uw_tax_event_tags', ['delete']), 'uw_ct_event'
'Create/edit types' => UwPermissions::buildRolePermissionsListTaxonomyTerm('uw_tax_event_type', ['create', 'edit']), ),
'Delete types' => UwPermissions::buildRolePermissionsListTaxonomyTerm('uw_tax_event_type', ['delete']), 'Create/edit tags' =>
UwPermissions::buildRolePermissionsListTaxonomyTerm(
'uw_tax_event_tags',
['create', 'edit']
),
'Delete tags' =>
UwPermissions::buildRolePermissionsListTaxonomyTerm(
'uw_tax_event_tags',
['delete']
),
'Create/edit types' =>
UwPermissions::buildRolePermissionsListTaxonomyTerm(
'uw_tax_event_type',
['create', 'edit']
),
'Delete types' =>
UwPermissions::buildRolePermissionsListTaxonomyTerm(
'uw_tax_event_type',
['delete']
),
], ],
// News permissions. // News permissions.
'News' => [ 'News' => [
'Use content type' => 'Use content type' =>
UwPermissions::buildRolePermissionsListContentType('uw_ct_news_item'), UwPermissions::buildRolePermissionsListContentType(
'uw_ct_news_item'
),
'Create/edit tags' => 'Create/edit tags' =>
UwPermissions::buildRolePermissionsListTaxonomyTerm('uw_vocab_news_tags', ['create', 'edit']), UwPermissions::buildRolePermissionsListTaxonomyTerm(
'uw_vocab_news_tags',
['create', 'edit']
),
'Delete tags' => 'Delete tags' =>
UwPermissions::buildRolePermissionsListTaxonomyTerm('uw_vocab_news_tags', ['delete']), UwPermissions::buildRolePermissionsListTaxonomyTerm(
'uw_vocab_news_tags',
['delete']
),
], ],
// Sidebar permissions. // Sidebar permissions.
'Sidebar' => [ 'Sidebar' => [
'Use content type' => 'Use content type' =>
UwPermissions::buildRolePermissionsListContentType('uw_ct_sidebar'), UwPermissions::buildRolePermissionsListContentType(
'uw_ct_sidebar'
),
], ],
// Site footer permissions. // Site footer permissions.
'Site footer' => [ 'Site footer' => [
'Use content type' => 'Use content type' =>
UwPermissions::buildRolePermissionsListContentType('uw_ct_site_footer'), UwPermissions::buildRolePermissionsListContentType(
'uw_ct_site_footer'
),
], ],
// Special alert permissions. // Special alert permissions.
'Special alert' => [ 'Special alert' => [
'Use content type' => 'Use content type' =>
UwPermissions::buildRolePermissionsListCustom('administer special alert'), UwPermissions::buildRolePermissionsListCustom(
'administer special alert'
),
], ],
// Web page permissions. // Web page permissions.
'Web page' => [ 'Web page' => [
'Use content type' => 'Use content type' =>
UwPermissions::buildRolePermissionsListContentType('uw_ct_web_page'), UwPermissions::buildRolePermissionsListContentType(
'uw_ct_web_page'
),
], ],
]; ];
......
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