FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • uis/devops/webcms/2023-platform/cambridge-drupal-platform
1 result
Show changes
Commits on Source (22)
Showing
with 358 additions and 26 deletions
......@@ -64,6 +64,9 @@
},
"enable-patching": true,
"patches": {
"drupal/core": {
"/filter/tips page has no access control (accessible by anonymouse users)": "patches/filter-tips-anonymous-users.patch"
},
"drupal/sdc_display": {
"Entity view alter removes needed properties from build array": "https://git.drupalcode.org/project/sdc_display/-/merge_requests/13.diff"
},
......
uuid: 59163b48-091c-4237-a9d4-0ba7394014ca
langcode: en
status: true
dependencies:
config:
- field.field.node.home_page.field_introduction
- field.field.node.home_page.field_page_summary
- field.field.node.home_page.field_paragraph
- field.field.node.home_page.field_title_prefix
- node.type.home_page
module:
- paragraphs
......@@ -21,10 +20,22 @@ mode: default
content:
created:
type: datetime_timestamp
weight: 3
weight: 4
region: content
settings: { }
third_party_settings: { }
field_introduction:
type: string_textarea
weight: 3
region: content
settings:
rows: 5
placeholder: ''
third_party_settings:
maxlength:
maxlength_js: 500
maxlength_js_label: 'Content limited to @limit characters, remaining: <strong>@remaining</strong>'
maxlength_js_enforce: true
field_page_summary:
type: string_textarea
weight: 1
......@@ -39,7 +50,7 @@ content:
maxlength_js_enforce: false
field_paragraph:
type: paragraphs
weight: 4
weight: 5
region: content
settings:
title: component
......@@ -76,27 +87,27 @@ content:
third_party_settings: { }
path:
type: path
weight: 7
weight: 8
region: content
settings: { }
third_party_settings: { }
promote:
type: boolean_checkbox
weight: 5
weight: 6
region: content
settings:
display_label: true
third_party_settings: { }
status:
type: boolean_checkbox
weight: 9
weight: 10
region: content
settings:
display_label: true
third_party_settings: { }
sticky:
type: boolean_checkbox
weight: 6
weight: 7
region: content
settings:
display_label: true
......@@ -112,10 +123,9 @@ content:
placeholder: ''
third_party_settings: { }
url_redirects:
weight: 8
weight: 9
region: content
settings: { }
third_party_settings: { }
hidden:
field_title_prefix: true
title: true
uuid: 383bdd2d-2567-482a-8ba6-18c3690bf002
langcode: en
status: true
dependencies:
config:
- field.field.node.home_page.field_introduction
- field.field.node.home_page.field_page_summary
- field.field.node.home_page.field_paragraph
- field.field.node.home_page.field_title_prefix
- node.type.home_page
module:
- layout_paragraphs
- sdc_display
- user
third_party_settings:
sdc_display:
enabled: false
component:
machine_name: ''
mappings:
static:
props: { }
slots: { }
dynamic:
props: { }
slots: { }
_core:
default_config_hash: AFLDR9tr2GyyXeTdWvNavYMarmgd5CN9gMXi9gaBcP8
id: node.home_page.default
......@@ -39,5 +51,5 @@ content:
weight: 1
region: content
hidden:
field_title_prefix: true
field_introduction: true
langcode: true
......@@ -16,6 +16,7 @@ module:
calendar: 0
calendar_datetime: 0
cam_admin_ui_tweaks: 0
cam_cookies: 0
cam_twigextension: 0
ckeditor: 0
ckeditor5: 0
......@@ -84,8 +85,8 @@ module:
layout_paragraphs: 0
libraries: 0
link: 0
linkchecker: 0
link_description: 0
linkchecker: 0
linkit: 0
locale: 0
masquerade: 0
......
langcode: en
status: true
dependencies:
config:
- field.storage.node.field_introduction
- node.type.home_page
id: node.home_page.field_introduction
field_name: field_introduction
entity_type: node
bundle: home_page
label: Introduction
description: ''
required: false
translatable: false
default_value: { }
default_value_callback: ''
settings: { }
field_type: string_long
langcode: en
status: true
dependencies:
module:
- node
id: node.field_introduction
field_name: field_introduction
entity_type: node
type: string_long
settings:
case_sensitive: false
module: core
locked: false
cardinality: 1
translatable: true
indexes: { }
persist_with_no_fields: false
custom_storage: false
diff --git a/core/modules/filter/filter.routing.yml b/core/modules/filter/filter.routing.yml
index 5b56da70..78923030 100644
--- a/core/modules/filter/filter.routing.yml
+++ b/core/modules/filter/filter.routing.yml
@@ -5,6 +5,7 @@ filter.tips_all:
_title: 'Compose tips'
requirements:
_access: 'TRUE'
+ _permission: 'administer filters'
filter.tips:
path: '/filter/tips/{filter_format}'
name: Cambridge cookie consent
type: module
core_version_requirement: ^10
package: Custom
dependencies:
- drupal:cambridge_platform
cookies.info:
path: '/cookie-consent'
defaults:
_controller: '\Drupal\cam_cookies\Controller\CookiesModalController::showInfo'
requirements:
_permission: 'access content'
\ No newline at end of file
<?php
namespace Drupal\cam_cookies\Controller;
use Drupal\cambridge_platform\Ajax\OpenCamDialogCommand;
use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Ajax\AjaxResponse;
class CookiesModalController extends ControllerBase {
/**
* @return \Drupal\Core\Ajax\AjaxResponse
*/
public function showInfo(): AjaxResponse {
$build = [
'#type' => 'component',
'#component' => 'cambridge_tailwind:cookie-banner',
'#props' => [
'title' => $this->t('Cookie information'),
'body' => [
'#markup' => ' Cookies are little files that we save on your device to remember your preferences. We use
<strong>necessary cookies</strong> to make our site work. We use <strong>site usage measurement cookies</strong> to analyse
anonymised usage patterns, to make our websites better for you.',
],
'url' => 'https://www.cam.ac.uk/about-this-site/cookies',
'link_text' => $this->t('Learn more'),
],
'#slots' => [],
];
$response = new AjaxResponse();
$response->addCommand(new OpenCamDialogCommand('#cookie-dialog', $build));
return $response;
}
}
<?php
/**
* @file
* Install, update and uninstall functions for the standard installation profile.
*/
<?php
/**
* @file
*/
/**
* Re-save the site information page, resolving the paths in config to the
* newly imported content entities.
* See: Drupal\cambridge_platform\EventSubscriber\DefaultContentEventSubscriber
*
* Split into a separate function for use within migration scripts.
*
* @return void
*/
function site_information_rebuild() {
$config = \Drupal::configFactory()->getEditable('system.site');
$page_front = $config->get('page.front');
$page_404 = $config->get('page.404');
try {
$page_front = \Drupal::service('path_alias.manager')
->getPathByAlias($page_front);
} catch (\Throwable $e) {
// If this failed, just ignore.
}
try {
$page_404 = \Drupal::service('path_alias.manager')
->getPathByAlias($page_404);
} catch (\Throwable $e) {
// If this failed, just ignore.
}
$config
->set('page.front', $page_front)
->set('page.404', $page_404)
->save();
drupal_flush_all_caches();
}
services:
cambridge_platform.event_subscriber:
class: Drupal\cambridge_platform\EventSubscriber\DefaultContentEventSubscriber
tags:
- { name: event_subscriber }
<?php
namespace Drupal\cambridge_platform\Ajax;
use Drupal\Core\Ajax\CommandInterface;
use Drupal\Core\Ajax\CommandWithAttachedAssetsInterface;
use Drupal\Core\Ajax\CommandWithAttachedAssetsTrait;
/**
* Defines an AJAX command to open certain content in a dialog.
*
* @ingroup ajax
*/
class OpenCamDialogCommand implements CommandInterface, CommandWithAttachedAssetsInterface {
use CommandWithAttachedAssetsTrait;
/**
* The selector of the dialog.
*
* @var string
*/
protected $selector;
/**
* The content for the dialog.
*
* Either a render array or an HTML string.
*
* @var string|array
*/
protected $content;
/**
* Custom settings passed to Drupal behaviors on the content of the dialog.
*
* @var array
*/
protected $settings;
/**
* Constructs an OpenDialogCommand object.
*
* @param string $selector
* The selector of the dialog.
* @param string|array $content
* The content that will be placed in the dialog, either a render array
* or an HTML string.
* @param array|null $settings
* (optional) Custom settings that will be passed to the Drupal behaviors
* on the content of the dialog. If left empty, the settings will be
* populated automatically from the current request.
*/
public function __construct($selector, $content, $settings = NULL) {
$this->selector = $selector;
$this->content = [
'#type' => 'component',
'#component' => 'cambridge_tailwind:modal',
'#props' => [
'content' => $content
],
'#slots' => [],
];
$this->settings = $settings;
}
/**
* Implements \Drupal\Core\Ajax\CommandInterface:render().
*/
public function render() {
// For consistency ensure the modal option is set to TRUE or FALSE.
return [
'command' => 'openCamDialog',
'selector' => $this->selector,
'settings' => $this->settings,
'data' => $this->getRenderedContent()
];
}
}
<?php
namespace Drupal\cambridge_platform\EventSubscriber;
use Drupal\default_content\Event\DefaultContentEvents;
use \Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Drupal\default_content\Event\ImportEvent;
use Drupal\Core\Config\ConfigEvents;
use Drupal\Core\Config\ConfigImporterEvent;
class DefaultContentEventSubscriber implements EventSubscriberInterface {
/**
* @return array|array[]|\array[][]|string[]
*/
public static function getSubscribedEvents() {
$events[DefaultContentEvents::IMPORT][] = ['onPostContentImportEvent'];
$events[ConfigEvents::IMPORT][] = ['onPostConfigImportEvent'];
return $events;
}
/**
* Re-build site information page settings, post config import. Required here
* to rebuild after `install_config_revert_install_changes` install task.
*
* @param \Drupal\Core\Config\ConfigImporterEvent $event
*
* @return void
*/
public function onPostConfigImportEvent(ConfigImporterEvent $event) {
site_information_rebuild();
}
/**
* Re-save the site information page settings using real node IDs from node
* alias, AFTER default content is imported.
*
* @param \Drupal\default_content\Event\ImportEvent $event
*
* @return void
*/
public function onPostContentImportEvent(ImportEvent $event) {
// Re-save the site information page, resolving the paths in config to the
// newly imported content entities.
site_information_rebuild();
}
}
\ No newline at end of file
......@@ -9,6 +9,7 @@ libraries:
- core/normalize
- cambridge_tailwind/global-styling
- cambridge_tailwind/global-scripts
- cambridge_tailwind/ajax
- cambridge_tailwind/message-banner-styling
libraries-override:
# Disable only some core system css files
......
......@@ -2,14 +2,20 @@ global-styling:
css:
base:
css/tailwind.css: {}
css/breadcrumbs.css: {}
component:
/core/themes/claro/css/base/variables.css: {}
/core/themes/claro/css/components/form.css: {}
/core/themes/claro/css/components/form--text.css: {}
/core/themes/claro/css/components/form--select.css: {}
theme:
/web/themes/contrib/gin/dist/css/theme/dialog.css: {}
global-scripts:
js:
js/ajax.js: {}
js/modal.js: {}
/core/assets/vendor/tua-body-scroll-lock/tua-bsl.umd.min.js:
{ weight: -1, minified: true }
dependencies:
- core/drupal.ajax
message-banner-styling:
css:
......
{% stories button_id with
{
title: 'Forms/Button',
argTypes: {
text: {
control: { type: "text" },
},
},
}
%}
{% story icon_link_1 with
{
name: '1. Button text',
args: {
text: 'Button text',
}
}
%}
{% include '@cambridge_tailwind/components/button/button.twig' with { text } %}
{% endstory %}
{% endstories %}
{% if not attributes %}
{% set attributes = create_attribute() %}
{% endif %}
<button{{ attributes }} class="bg-button-primary-default hover:bg-button-primary-hover active:bg-button-primary-hover text-white rounded-56 py-14 px-16 active:outline-none focus-visible:outline-offset-2 focus-visible:outline focus-visible:outline-4 focus-visible:active:outline-none focus-visible:focus-light ">{% apply spaceless %}
{{ text | raw }}
{% endapply %}</button>
......@@ -83,10 +83,7 @@
{{ sidebar_items }}
</aside>
{% endif %}
</div>
</div>
</div>
</div>
</article>