Skip to content
Snippets Groups Projects
Commit af3c37c4 authored by Alexandre Dias's avatar Alexandre Dias
Browse files

Merge branch 'ISAICP-7728' into 'master'

ISAICP-7728: Fix visual regressions after release v1.92.0.

See merge request !109
parents 0284017d 75ab9f1e
No related branches found
Tags v1.92.1
1 merge request!109ISAICP-7728: Fix visual regressions after release v1.92.0.
......@@ -13,117 +13,3 @@
*/
declare(strict_types = 1);
use Drupal\sparql_entity_storage\UriEncoder;
/**
* Fix glossary link for solution entities.
*/
function joinup_core_deploy_109200(array &$sandbox = []): string {
/** @var \Drupal\sparql_entity_storage\SparqlEntityStorageInterface $solutionStorage */
$solutionStorage = \Drupal::entityTypeManager()
->getStorage('rdf_entity');
/** @var \Drupal\menu_link_content\MenuLinkContentStorageInterface $menuLinkContentStorage */
$menuLinkContentStorage = \Drupal::entityTypeManager()
->getStorage('menu_link_content');
if (empty($sandbox['ids'])) {
$solutionIds = $solutionStorage->getQuery()
->accessCheck(FALSE)
->condition('rid', 'solution')
->execute();
$sandbox['ids'] = array_values($solutionIds);
$sandbox['max'] = count($sandbox['ids']);
$sandbox['current'] = 0;
}
$ids = array_splice($sandbox['ids'], 0, 100);
/** @var \Drupal\solution\Entity\SolutionInterface $solution */
foreach ($solutionStorage->loadMultiple($ids) as $solution) {
$menuIds = $menuLinkContentStorage->getQuery()
->accessCheck(FALSE)
->condition('menu_name', 'ogmenu-', 'STARTS_WITH')
->condition('title', 'Glossary')
->condition('link.uri', 'route:entity.rdf_entity.glossary', 'STARTS_WITH')
->condition('link.uri', UriEncoder::encodeUrl($solution->id()), 'ENDS_WITH')
->execute();
if (empty($menuIds)) {
continue;
}
/** @var Drupal\menu_link_content\Entity\MenuLinkContent $menuLinkContent */
$menuLinkContent = $menuLinkContentStorage->load(reset($menuIds));
if (!$menuLinkContent) {
continue;
}
$menuLinkContent->link->uri = str_replace(
UriEncoder::encodeUrl($solution->id()),
UriEncoder::encodeUrl($solution->getCollection()->id()),
$menuLinkContent->link->uri
);
$menuLinkContent->save();
}
$sandbox['current'] += count($ids);
$sandbox['#finished'] = (int) empty($sandbox['ids']);
return "Updated {$sandbox['current']} of {$sandbox['max']} glossary menu links.";
}
/**
* Adding blocked users before the spam activity (03/12/2022) to queue.
*/
function joinup_core_deploy_109201(): string {
$from_date = new \DateTime("2022/12/03");
$users_ids = \Drupal::entityQuery('user')
->accessCheck(FALSE)
->condition('status', '0')
->condition('uid', 1, '>')
->condition('created', $from_date->getTimestamp(), '<=')
->execute();
$count = count($users_ids);
$queue = \Drupal::queue('joinup_removed_users');
$queue->createQueue();
while (!empty($users_ids)) {
$ids = array_splice($users_ids, 0, 10);
$queue->createItem($ids);
}
return "Add $count users to queue.";
}
/**
* Clears the entity definition cache.
*/
function joinup_core_deploy_109202(): string {
$entityTypeManager = \Drupal::entityTypeManager();
$entityTypeManager->clearCachedDefinitions();
// Install the field_discussion_logo field to the discussion node bundle.
try {
$fieldStorage = $entityTypeManager->getStorage('field_storage_config')->load('node.field_discussion_logo');
$fieldStorage->setTranslatable(TRUE);
$fieldStorage->save();
}
catch (\Exception $e) {
return 'Could not install discussion logo field storage.';
}
try {
$field = $entityTypeManager->getStorage('field_config')->load('node.discussion.field_discussion_logo');
$field->setTranslatable(TRUE);
$field->save();
}
catch (\Exception $e) {
return 'Could not install discussion logo field instance.';
}
return 'Entity definition cache cleared. Discussion logo installed.';
}
......@@ -8,7 +8,6 @@
declare(strict_types = 1);
use Drupal\Core\Site\Settings;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\user\Entity\User;
/**
......@@ -93,42 +92,3 @@ function joinup_core_requirements($phase): array {
return $requirements;
}
/**
* Enables the `memcache` module.
*/
function joinup_core_update_109200(): void {
\Drupal::service('module_installer')->install(['memcache']);
}
/**
* Update and trim existing first and family names.
*/
function joinup_core_update_109201(): void {
$database = \Drupal::database();
$num_chars = 100;
$fields_to_update = ['field_user_family_name', 'field_user_first_name'];
$storage_schema = \Drupal::keyValue('entity.storage_schema.sql');
foreach ($fields_to_update as $field_name) {
$table_name = 'user__' . $field_name;
$database->query("UPDATE {$table_name} SET {$field_name}_value = SUBSTR({$field_name}_value, 1, 100) WHERE LENGTH({$field_name}_value) > 100");
// Resize the columns.
$database->query("ALTER TABLE {$table_name} MODIFY {$field_name}_value VARCHAR($num_chars)");
// Update storage schema.
$storage_key = "user.field_schema_data." . $field_name;
$field_schema = $storage_schema->get($storage_key);
$field_schema["user__{$field_name}"]['fields']["{$field_name}_value"]['length'] = $num_chars;
$storage_schema->set($storage_key, $field_schema);
// Update field configuration.
\Drupal::configFactory()->getEditable("field.storage.user.{$field_name}")
->set('settings.max_length', $num_chars)
->save(TRUE);
// Update field storage configuration.
FieldStorageConfig::loadByName('user', $field_name)->save();
}
}
This diff is collapsed.
......@@ -70,7 +70,7 @@ function _ventuno_preprocess_tile(array &$variables, string $entity_type_id): vo
// Bundle label and icon.
$bundle_type = $entity->get($bundle_key)->entity;
$variables['bundle']['label'] = ucfirst($bundle_type->getSingularLabel() ?? $bundle_type->label());
$variables['bundle']['icon'] = _ventuno_get_default_icon_render_array($entity->getEntityTypeId(), $entity->bundle());
$variables['bundle']['icon'] = _ventuno_get_default_icon($entity->getEntityTypeId(), $entity->bundle());
}
/**
......@@ -133,7 +133,7 @@ function _ventuno_preprocess_search_result(array &$variables, string $entity_typ
}
/**
* Returns the default icon for the given bundle or the generic entity icon.
* Returns the default icon id for the given bundle or a generic icon id.
*
* @param string $entity_type_id
* The entity type ID.
......@@ -143,7 +143,7 @@ function _ventuno_preprocess_search_result(array &$variables, string $entity_typ
* @return string
* The icon id.
*/
function _ventuno_get_default_icon_render_array(string $entity_type_id, string $bundle): string {
function _ventuno_get_default_icon(string $entity_type_id, string $bundle): string {
$mapping = [
'node' => [
'custom_page' => 'file-earmark-richtext',
......@@ -166,6 +166,50 @@ function _ventuno_get_default_icon_render_array(string $entity_type_id, string $
return $mapping[$entity_type_id][$bundle] ?? 'lightning-charge';
}
/**
* Returns icon as render array for the bundle or a generic icon render array.
*
* @todo ISAICP-7709 With tiles redesign, the search items won't need this so
* we can delete this function.
*
* @param string $entity_type_id
* The entity type ID.
* @param string $bundle
* The bundle.
*
* @return array
* The icon class render array.
*/
function _ventuno_get_default_icon_render_array(string $entity_type_id, string $bundle): array {
$mapping = [
'node' => [
'custom_page' => 'file-earmark-richtext',
'discussion' => 'chat-left-text',
'document' => 'file-earmark-text',
'event' => 'calendar-event',
'news' => 'newspaper',
'tallinn_report' => 'journal-text',
'video' => 'file-earmark-play',
],
'rdf_entity' => [
'collection' => 'folder2-open',
'licence' => 'file-earmark-medical',
'asset_distribution' => 'file-earmark-post',
'asset_release' => 'file-earmark-zip',
'solution' => 'clipboard2-check',
],
];
$class = $mapping[$entity_type_id][$bundle] ?? 'lightning-charge';
return [
'#type' => 'inline_template',
'#template' => '<svg class="bi img-fluid w-100 py-3 p-lg-3 text-white bg-secondary"><use xlink:href="' . base_path() . \Drupal::service('extension.list.theme')->getPath('ventuno') . '/assets/icons/icons.svg#{{ icon }}"></use></svg>',
'#context' => [
'icon' => $class,
],
];
}
/**
* Builds the permalink for the given route.
*
......
......@@ -57,6 +57,7 @@
color: $gray-700;
}
article {
h1,
h2 {
font-size: $font-size-base;
font-weight: $font-weight-medium;
......
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