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
Select Git revision

Target

Select target project
  • project/manage_display
  • issue/manage_display-3143678
  • issue/manage_display-3228275
  • issue/manage_display-3247904
  • issue/manage_display-2984443
  • issue/manage_display-3291074
  • issue/manage_display-3301707
  • issue/manage_display-3347194
  • issue/manage_display-3352053
  • issue/manage_display-3364904
  • issue/manage_display-3371841
  • issue/manage_display-3414907
  • issue/manage_display-3380114
  • issue/manage_display-3381626
  • issue/manage_display-3416673
  • issue/manage_display-3419164
  • issue/manage_display-3419166
  • issue/manage_display-3422986
  • issue/manage_display-3364917
  • issue/manage_display-3441228
  • issue/manage_display-3431800
  • issue/manage_display-3381312
  • issue/manage_display-3392273
  • issue/manage_display-3526547
24 results
Select Git revision
Show changes
Commits on Source (12)
################
# DrupalCI GitLabCI template
#
# Gitlab-ci.yml to replicate DrupalCI testing for Contrib
#
# With thanks to:
# * The GitLab Acceleration Initiative participants
# * DrupalSpoons
################
################
# Guidelines
#
# This template is designed to give any Contrib maintainer everything they need to test, without requiring modification. It is also designed to keep up to date with Core Development automatically through the use of include files that can be centrally maintained.
#
# However, you can modify this template if you have additional needs for your project.
################
################
# Includes
#
# Additional configuration can be provided through includes.
# One advantage of include files is that if they are updated upstream, the changes affect all pipelines using that include.
#
# Includes can be overridden by re-declaring anything provided in an include, here in gitlab-ci.yml
# https://docs.gitlab.com/ee/ci/yaml/includes.html#override-included-configuration-values
################
include:
################
# DrupalCI includes:
# As long as you include this, any future includes added by the Drupal Association will be accessible to your pipelines automatically.
# View these include files at https://git.drupalcode.org/project/gitlab_templates/
################
- project: $_GITLAB_TEMPLATES_REPO
# "ref" value can be:
# - Recommended (default) - `ref: $_GITLAB_TEMPLATES_REF` - The Drupal Association will update this value to the recommended tag for contrib.
# - Latest - `ref: main` - Get the latest additions and bug fixes as they are merged into the templates.
# - Minor or Major latests - `ref: 1.x-latest` or `ref: 1.0.x-latest` - Get the latest additions within a minor (mostly bugfixes) or major (bugs and new features).
# - Fixed tag - `ref: 1.0.1` - Set the value to a known tag. This will not get any updates.
ref: $_GITLAB_TEMPLATES_REF
file:
- '/includes/include.drupalci.main.yml'
# EXPERIMENTAL: For Drupal 7, remove the above line and uncomment the below.
# - '/includes/include.drupalci.main-d7.yml'
- '/includes/include.drupalci.variables.yml'
- '/includes/include.drupalci.workflows.yml'
################
# Pipeline configuration variables
#
# These are the variables provided to the Run Pipeline form that a user may want to override.
#
# Docs at https://git.drupalcode.org/project/gitlab_templates/-/blob/1.0.x/includes/include.drupalci.variables.yml
################
# variables:
# SKIP_ESLINT: '1'
{
"name": "drupal/manage_display",
"description": "This project makes base fields such as 'title' available in 'Manage Display'.",
"type": "drupal-module",
"license": "GPL-2.0-or-later",
"keywords": ["Drupal"],
"homepage": "https://www.drupal.org/project/manage_display",
"authors": [
{
"name": "Adam Shepherd (AdamPS)",
"homepage": "https://www.drupal.org/u/adamps",
"role": "Maintainer"
},
{
"name": "Viktor Holovachek (AstonVictor)",
"homepage": "https://www.drupal.org/u/astonvictor",
"role": "Maintainer"
}
],
"minimum-stability": "dev",
"support": {
"issues": "https://www.drupal.org/project/issues/manage_display",
"source": "https://git.drupalcode.org/project/manage_display"
},
"require": { }
}
name: Manage Display
type: module
description: Make base fields such as 'title' available in "Manage Display"
core_version_requirement: ^9.4 || ^10
core_version_requirement: ^9.4 || ^10 || ^11
package: Fields
......@@ -21,18 +21,26 @@ function manage_display_update_9201() {
*/
function manage_display_update_9301() {
$storage = \Drupal::entityTypeManager()->getStorage('entity_view_display');
foreach ($storage->loadMultiple() as $id => $display) {
$need_to_save = FALSE;
/** @var \Drupal\Core\Entity\Display\EntityViewDisplayInterface $display */
foreach ($display->getComponents() as $name => $options) {
$type = $options['type'] ?? '';
$linked = $options['settings']['linked'] ?? NULL;
if ($type == 'title' && !is_null($linked)) {
if (isset($options['type']) && $options['type'] == 'title' && !is_null($linked)) {
unset($options['settings']['linked']);
$options['settings']['link_to_entity'] = $linked;
$display->setComponent($name, $options);
$display->save();
$need_to_save = TRUE;
}
}
if ($need_to_save) {
$display->save();
}
}
}
......
......@@ -5,13 +5,32 @@
* Make base fields such as 'title' available in "Manage Display".
*/
use Drupal\comment\CommentInterface;
use Drupal\Core\Entity\Display\EntityViewDisplayInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Link;
use Drupal\Core\Routing\RouteMatchInterface;
use Drupal\Core\Template\Attribute;
use Drupal\comment\CommentInterface;
use Drupal\Core\Url;
/**
* Implements hook_help().
*/
function manage_display_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
case 'help.page.manage_display':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t("This project makes base fields such as 'title' available in 'Manage Display'. This very simple module uses the framework that is already in Core rather than inventing anything new. The goal is that most or all of this module will be absorbed into core.") . '</p>';
$output .= '<h3>' . t('Formatters:') . '</h3>';
$output .= '<ul><li>' . t("Title - The Title formatter is designed for any label or title field. It is based on the Core 'Plain text' formatter with an additional setting to select the Tag to wrap around the title.") . '</li>';
$output .= '<li>' . t("Submitted - The Submitted formatter matches the sentence shown by Drupal Core for nodes and comments: 'Submitted by AAA on DDD' (AAA is the author and DDD is the date).") . '</li>';
$output .= '<li>' . t("In reply to - The 'In reply to' formatter is intended specifically for the comment 'Parent ID' field, to be used in combination with the Submitted formatter.") . '</li></ul>';
return $output;
}
}
/**
* Implements hook_entity_type_build().
......@@ -167,6 +186,7 @@ function manage_display_base_field_info($entity_type_id) {
* Implements hook_theme().
*/
function manage_display_theme() {
$node_path = \Drupal::service('extension.path.resolver')->getPath('module', 'node');
return [
'submitted' => [
'variables' => [
......@@ -187,14 +207,17 @@ function manage_display_theme() {
// Reuse the special 'inline' node templates for other entity types.
'field__uid' => [
'base hook' => 'field',
'path' => $node_path . '/templates',
'template' => 'field--node--uid',
],
'field__created' => [
'base hook' => 'field',
'path' => $node_path . '/templates',
'template' => 'field--node--created',
],
'field__comment__pid' => [
'base hook' => 'field',
'path' => $node_path . '/templates',
'template' => 'field--node--title',
],
];
......@@ -253,7 +276,7 @@ function manage_display_preprocess_field(&$variables) {
_manage_display_preprocess_inline_field($variables);
$element = $variables['element'];
if ($element['#entity_type'] == 'comment') {
if ($element['#entity_type'] == 'comment' && !$element['#object']->isNew()) {
$formatters = [
'subject' => ['title' => TRUE, 'string' => TRUE],
'uid' => ['submitted' => TRUE, 'author' => TRUE],
......@@ -327,7 +350,7 @@ function manage_display_form_system_theme_settings_alter(&$form, FormStateInterf
/**
* Fixes a render array for a single item of a comment field.
*
* Match the default behaviour of Drupal Core custom pre-processing.
* Match the default behavior of Drupal Core custom pre-processing.
*
* @param array $item
* The render array for a single item of a field.
......@@ -340,7 +363,7 @@ function manage_display_form_system_theme_settings_alter(&$form, FormStateInterf
*/
function _manage_display_fix_comment_item(array &$item, string $name, CommentInterface $comment) {
if ($name == 'subject') {
// Use permalink and add attributes to match Core default behaviour.
// Use permalink and add attributes to match Core default behavior.
$url = $comment->permalink();
$attributes = $url->getOption('attributes') ?: [];
$attributes += ['class' => ['permalink'], 'rel' => 'bookmark'];
......
name: Manage Display Fix Title
type: module
description: Workaround for core bugs in display of entity title
core_version_requirement: ^8.8 || ^9
package: Fields
lifecycle: obsolete
lifecycle_link: 'https://www.drupal.org/project/manage_display/issues/3291074'
\ No newline at end of file
# Configuration file for PHPStan static code checking.
# @see: https://git.drupalcode.org/project/drupal/-/blob/10.0.x/core/phpstan.neon.dist
parameters:
level: 1
ignoreErrors:
# new static() is a best practice in Drupal, so we cannot fix that.
# @see https://www.drupal.org/docs/develop/development-tools/phpstan/handling-unsafe-usage-of-new-static
- "#^Unsafe usage of new static#"
......@@ -30,6 +30,10 @@ class InReplyToFormatter extends FormatterBase {
$elements = [];
foreach ($items->referencedEntities() as $delta => $comment) {
if ($comment->isNew()) {
continue;
}
$all_options = [
'subject' => [
'type' => 'string',
......
......@@ -34,6 +34,7 @@ class CommentManageDisplayTest extends CommentTestBase {
* {@inheritdoc}
*/
protected function setUp(): void {
parent::setUp();
BrowserTestBase::setUp();
$this->drupalCreateContentType(['type' => 'article', 'name' => 'Article']);
$this->addDefaultCommentField('node', 'article');
......