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

Merge branch '8.x-1.x' into feature/ISTWCMS-4212-ebremner-events-multi-type

parents d01cdc4e 6db4c581
No related branches found
No related tags found
1 merge request!20ISTWCMS-4212: adding function to get correct short month name
Showing
with 240 additions and 93 deletions
langcode: en
status: true
dependencies: { }
id: inline_blockuw_cbl_timeline
block_id: 'inline_block:uw_cbl_timeline'
category: uw_bc_content
label: Timeline
weight: 0
image_path: /profiles/uw_base_profile/themes/uw_fdsu_theme_resp/images/layout_builder_browser/timeline.svg
image_alt: ''
langcode: en
status: true
dependencies: { }
id: inline_blockuw_cbl_twitter
block_id: 'inline_block:uw_cbl_twitter'
category: uw_bc_external_embeds
label: Twitter
weight: 0
image_path: /profiles/uw_base_profile/themes/uw_fdsu_theme_resp/images/layout_builder_browser/twitter.svg
image_alt: ''
langcode: en
status: true
dependencies: { }
id: uw_cbl_blog_teaser
block_id: uw_cbl_blog_teaser
category: uw_bc_teasers
label: 'Blog post teaser'
weight: 0
image_path: /profiles/uw_base_profile/themes/uw_fdsu_theme_resp/images/layout_builder_browser/blogteaser.svg
image_alt: ''
langcode: en
status: true
dependencies: { }
id: uw_cbl_event_teaser
block_id: uw_cbl_event_teaser
category: uw_bc_teasers
label: 'Event teaser'
weight: 0
image_path: /profiles/uw_base_profile/themes/uw_fdsu_theme_resp/images/layout_builder_browser/eventteaser.svg
image_alt: ''
langcode: en
status: true
dependencies: { }
id: uw_cbl_multi_type_list
block_id: uw_cbl_multi_type_list
category: uw_bc_listings
label: 'Multi-type list'
weight: 0
image_path: /profiles/uw_base_profile/themes/uw_fdsu_theme_resp/images/layout_builder_browser/multitypelist.svg
image_alt: ''
langcode: en
status: true
dependencies: { }
id: uw_cbl_news_teaser
block_id: uw_cbl_news_teaser
category: uw_bc_teasers
label: 'News item teaser'
weight: 0
image_path: /profiles/uw_base_profile/themes/uw_fdsu_theme_resp/images/layout_builder_browser/newsteaser.svg
image_alt: ''
langcode: en
status: true
dependencies: { }
id: views_blockuw_view_blogs-blogs_listing_block
block_id: 'views_block:uw_view_blogs-blogs_listing_block'
category: uw_bc_listings
label: 'Blog post list'
weight: -2
image_path: /profiles/uw_base_profile/themes/uw_fdsu_theme_resp/images/layout_builder_browser/bloglist.svg
image_alt: ''
langcode: en
status: true
dependencies: { }
id: views_blockuw_view_events-events_listing_block
block_id: 'views_block:uw_view_events-events_listing_block'
category: uw_bc_listings
label: 'Event list'
weight: -1
image_path: /profiles/uw_base_profile/themes/uw_fdsu_theme_resp/images/layout_builder_browser/eventlist.svg
image_alt: ''
langcode: en
status: true
dependencies: { }
id: views_blockuw_view_news_items-news_items_listing_block
block_id: 'views_block:uw_view_news_items-news_items_listing_block'
category: uw_bc_listings
label: 'News item list'
weight: 1
image_path: /profiles/uw_base_profile/themes/uw_fdsu_theme_resp/images/layout_builder_browser/newslist.svg
image_alt: ''
langcode: en
status: true
dependencies: { }
id: webform_block
block_id: webform_block
category: uw_bc_webforms
label: Webform
weight: 0
image_path: /profiles/uw_base_profile/themes/uw_fdsu_theme_resp/images/layout_builder_browser/webform.svg
image_alt: ''
......@@ -20,11 +20,6 @@ blocks:
weight: 0
image_path: /profiles/uw_base_profile/themes/uw_fdsu_theme_resp/images/layout_builder_browser/copytext.svg
image_alt: ''
-
block_id: 'inline_block:uw_cbl_expand_collapse'
weight: 0
image_path: /profiles/uw_base_profile/themes/uw_fdsu_theme_resp/images/layout_builder_browser/expandcollapse.svg
image_alt: ''
-
block_id: 'inline_block:uw_cbl_facts_and_figures'
weight: 0
......
......@@ -4,39 +4,3 @@ dependencies: { }
id: uw_bc_external_embeds
label: 'External embeds'
weight: null
blocks:
-
block_id: 'inline_block:uw_cbl_facebook'
weight: 0
image_path: /profiles/uw_base_profile/themes/uw_fdsu_theme_resp/images/layout_builder_browser/facebook.svg
image_alt: ''
-
block_id: 'inline_block:uw_cbl_instagram'
weight: 0
image_path: /profiles/uw_base_profile/themes/uw_fdsu_theme_resp/images/layout_builder_browser/instagram.svg
image_alt: ''
-
block_id: 'inline_block:uw_cbl_remote_video'
weight: 0
image_path: /profiles/uw_base_profile/themes/uw_fdsu_theme_resp/images/layout_builder_browser/video.svg
image_alt: ''
-
block_id: 'inline_block:uw_cbl_tableau'
weight: 0
image_path: /profiles/uw_base_profile/themes/uw_fdsu_theme_resp/images/layout_builder_browser/tableau.svg
image_alt: ''
-
block_id: 'inline_block:uw_cbl_twitter'
weight: 0
image_path: /profiles/uw_base_profile/themes/uw_fdsu_theme_resp/images/layout_builder_browser/twitter.svg
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: ''
......@@ -4,24 +4,3 @@ dependencies: { }
id: uw_bc_listings
label: Listings
weight: null
blocks:
-
block_id: 'views_block:uw_view_blogs-blogs_listing_block'
weight: 0
image_path: /profiles/uw_base_profile/themes/uw_fdsu_theme_resp/images/layout_builder_browser/bloglist.svg
image_alt: ''
-
block_id: 'views_block:uw_view_events-events_listing_block'
weight: 0
image_path: /profiles/uw_base_profile/themes/uw_fdsu_theme_resp/images/layout_builder_browser/eventlist.svg
image_alt: ''
-
block_id: 'views_block:uw_view_news_items-news_items_listing_block'
weight: 0
image_path: /profiles/uw_base_profile/themes/uw_fdsu_theme_resp/images/layout_builder_browser/newslist.svg
image_alt: ''
-
block_id: uw_cbl_multi_type_list
weight: 0
image_path: /profiles/uw_base_profile/themes/uw_fdsu_theme_resp/images/layout_builder_browser/multitypelist.svg
image_alt: ''
......@@ -4,19 +4,3 @@ dependencies: { }
id: uw_bc_teasers
label: Teasers
weight: null
blocks:
-
block_id: uw_cbl_blog_teaser
weight: 0
image_path: /profiles/uw_base_profile/themes/uw_fdsu_theme_resp/images/layout_builder_browser/blogteaser.svg
image_alt: ''
-
block_id: uw_cbl_news_teaser
weight: 0
image_path: /profiles/uw_base_profile/themes/uw_fdsu_theme_resp/images/layout_builder_browser/newsteaser.svg
image_alt: ''
-
block_id: uw_cbl_event_teaser
weight: 0
image_path: /profiles/uw_base_profile/themes/uw_fdsu_theme_resp/images/layout_builder_browser/eventteaser.svg
image_alt: ''
......@@ -4,9 +4,3 @@ dependencies: { }
id: uw_bc_webforms
label: Webforms
weight: null
blocks:
-
block_id: webform_block
weight: 0
image_path: /profiles/uw_base_profile/themes/uw_fdsu_theme_resp/images/layout_builder_browser/webform.svg
image_alt: ''
pattern: '[user:field_uw_first_name] [user:field_uw_last_name]'
......@@ -15,6 +15,9 @@ permissions:
- 'skip CAPTCHA'
- 'use text format uw_tf_basic'
- 'use text format uw_tf_standard'
- 'userprotect.account.edit'
- 'userprotect.mail.edit'
- 'userprotect.pass.edit'
- 'view media'
- 'view paragraph content uw_para_call_to_action'
- 'view paragraph content uw_para_call_to_action_text'
......
......@@ -17,7 +17,9 @@ permissions:
- 'administer main menu items'
- 'administer role expire'
- 'administer shortcuts'
- 'administer users'
- 'administer uw-menu-audience-menu menu items'
- 'assign roles'
- 'can override my_dashboard dashboard'
- 'can view my_dashboard dashboard'
- 'create and edit custom blocks'
......
langcode: en
status: true
dependencies:
config:
- user.role.authenticated
module:
- user
name: uw_protect_authenticated_user
label: 'Authenticated user'
protectedEntityTypeId: user_role
protectedEntityId: authenticated
protections:
user_delete:
id: user_delete
provider: userprotect
status: true
user_status:
id: user_status
provider: userprotect
status: true
......@@ -64,14 +64,36 @@ class UwContentModerationForm extends ConfirmFormBase {
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state, $nid = NULL, $vid = NULL) {
public function buildForm(array $form, FormStateInterface $form_state, $nid = NULL, $vid = NULL, $status = NULL) {
// Set the node and version ids.
// Set the node, version id and status.
$this->nid = $nid;
$this->vid = $vid;
// Return the form from the parent (confirm form).
return parent::buildForm($form, $form_state);
$this->status = $status;
// Get the form from the parent, we need this to ensure
// that we have all the components (like confirm/cancel)
// load with this form as well.
$form = parent::buildForm($form, $form_state);
// Unset the description, we want to replace it with our
// description based on the node status.
unset($form['description']);
// Set the description form element.
$form['description'] = [
'#type' => 'markup',
];
// Set the description based on the node status.
if ($this->status) {
$form['description']['#markup'] = $this->t('Are you sure that you want to unpublish the live revision of this content?');
}
else {
$form['description']['#markup'] = $this->t('Are you sure that you want to publish the current revision of this content?');
}
return $form;
}
/**
......@@ -79,6 +101,58 @@ class UwContentModerationForm extends ConfirmFormBase {
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
// If we are unpublishing, load the latest revision node.
if ($this->status) {
// Load the node with the nid.
$node = $this->entityTypeManager->getStorage('node')->load($this->nid);
// Get all the revisions for the current node.
$revision_ids = $this->entityTypeManager->getStorage('node')->revisionIds($node);
// Get the node object with that latest revision, which is the end
// of the revision ids list.
$node = $this->entityTypeManager->getStorage('node')->loadRevision(end($revision_ids));
}
// If we are publishing, load the node with the nid.
else {
// Get the node object.
$node = $this->entityTypeManager->getStorage('node')->loadRevision($this->vid);
}
// If the node is currently published, then we want to
// unpublish this content, which will mean to move from
// two statesL upublish and draft.
if ($this->status) {
// First set the node to unpublished, we need to do this
// because moving it to just draft will not cause it to
// become unpublished.
$node->set('moderation_state', 'uw_wf_unpublished');
// Save the node to move it to unpublished.
$saved_status = $node->save();
// Now set the node moderation state to draft.
$node->set('moderation_state', 'draft');
// Save the node with the moderation state at draft.
$saved_status = $node->save();
}
// If the node is already unpublished, we want to move to the
// published moderation state.
else {
// Set the moderation state to publish.
$node->set('moderation_state', 'published');
// Save the node with the moderation state at published.
$saved_status = $node->save();
}
// Set the options for the URL.
$options = ['absolute' => TRUE];
......@@ -88,8 +162,30 @@ class UwContentModerationForm extends ConfirmFormBase {
// 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.'));
// If the saved status is SAVED_UPDATED (2), means that we successfully
// changed the moderation state so set the message appropriately.
if ($saved_status == SAVED_UPDATED) {
if ($this->status) {
$this->messenger()->addStatus($this->t('You have successfully unpublished this content.'));
}
else {
$this->messenger()->addStatus($this->t('You have successfully published this content.'));
}
}
// If the saved status is anything else, there was an
// error trying to change the moderation state so set
// the message appropriately.
else {
if ($this->status) {
$this->messenger()->addError($this->t('There was an error trying to unpublish this content.'));
}
else {
$this->messenger()->addError($this->t('There was an error trying to publish this content.'));
}
}
}
/**
......@@ -103,8 +199,17 @@ class UwContentModerationForm extends ConfirmFormBase {
// 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()]);
// Set the question (title of page) based on node status.
if ($this->status) {
// Return the question to see if they want to publish the node.
return $this->t('Unpublish %node_title?', ['%node_title' => $node->getTitle()]);
}
else {
// Return the question to see if they want to publish the node.
return $this->t('Publish %node_title?', ['%node_title' => $node->getTitle()]);
}
}
/**
......
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