Quantcast
Channel: Issues for Drupal core
Viewing all 296841 articles
Browse latest View live

Memory requirement >2G for composer installation

$
0
0

I am trying to install D8 with composer (using drupal-composer/drupal-project) on SiteGround (max 1G memory) and A2Hosting (max 2G memory) and am getting memory errors, as per example below:

santisch@nl1-ls3 [~/public_html]# composer create-project drupal-composer/drupal-project:8.x-dev d_test4 --stability dev --no-interaction
Installing drupal-composer/drupal-project (8.x-dev c1e2b6e6b32d51e75321d76c503714d8515e2420)
  - Installing drupal-composer/drupal-project (8.x-dev c1e2b6e)
    Cloning c1e2b6e6b32d51e75321d76c503714d8515e2420

Created project in d_test4
> DrupalProject\composer\ScriptHandler::checkComposerVersion
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing cweagans/composer-patches (1.6.5)
    Loading from cache

  - Installing composer/installers (v1.6.0)
    Loading from cache

  - Installing composer/semver (1.4.2)
    Loading from cache

  - Installing drupal-composer/drupal-scaffold (2.5.4)
    Loading from cache

...

  - Installing doctrine/common (v2.10.0)
    Loading from cache

  - Installing asm89/stack-cors (1.2.0)
    Loading from cache

  - Installing drupal/core (8.6.4)
    Downloading: 25%          
Fatal error: Allowed memory size of 2147483648 bytes exhausted (tried to allocate 6291488 bytes) in phar:///opt/cpanel/composer/bin/composer/src/Composer/Util/RemoteFilesystem.php on line 280

Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.santisch@nl1-ls3

I was able to install earlier versions of D8 with composer on A2Hosting. It appears that Drupal/core is (too) large now. On SiteGround I am currently stuck with D 8.3 and an old composer installation.

Can anybody confirm that >2G memory is required for newer D8 installations? Are there any workarounds possible to remain within the current hosting plan? Can the core be split up for a less memory intensive installation?


Adding a documentation guide to "Contributed modules" is totally dysfunctional

$
0
0

From https://www.drupal.org/node/2785809/discuss:

TR commented 20 October 2017 at 13:28

So I migrated my module's documentation to the new system, following the instructions, and yet my new documentation guide does not show up here - I still see "This guide has not yet been reviewed by Contributed modules maintainer(s) and added to the menu."

There's no step in the instructions that says I have to request this to be "reviewed", and no issue queue that I know of where I can post an issue requesting "review", so why has my module documentation not been reviewed and published yet?

  • There is still no procedure to get contributed module documentation guides published.
  • There is still no issue queue to handle requests for publication.
  • There's still no-one to contact when there are problems.
  • Guide maintainers are still not notified of new content.

I have about ~100 pages of documentation that I've written that have been posted since June 2018, but still do not show up under the "Contributed modules" documentation guide. What do I have to do to get this "added to the menu"?

This has to be fixed! If you want people to write documentation for D8, then let them publish it! And document the procedure needed, and make an issue queue for the publishing workflow and related problems.

Can't show 'revision author' on Block content views

Views Filter group "Or" operator not working

$
0
0

Hello,

The "Or" operator in filter groups act as an "And" operator.

Example:

or

I would like to display content tagged with a term in the "Composition" vocabulary OR with a term in the "Support" Vocabulary.

But the result act as an "AND" condition, the two filters are applied in the same time:

- If i choose only one term in the "Composition" filter i get 5 results
- If i choose only one term in the "Support" filter i get 2 results

So if choose theses terms in the same time the view should give me 5 + 2 results
But i only get 3 nodes tagged with each term.

Any help ?

Thanks

ToolkitGdTest uses checkRequirements() incorrectly

$
0
0

Problem/Motivation

Doing some follow-through on #2728579: Explicitly skip @requires module in PHPUnit Kernel and Browser tests I discovered that ToolkitGdTest has a checkRequirements() method, which overrides \PHPUnit_Framework_TestCase::checkRequirements().

This is probably left over from the Simpletest days. It was converted from Simpletest with all system module tests in #2687897: Convert system module's kernel tests to NG

The problem is that it tries to signal its requirements by returning a value, even though PHPUnit ignores the returned value and expects an exception if the requirement isn't met.

Here's what it looks like:

  protected function checkRequirements() {
    // GD2 support is available.
    if (!function_exists('imagegd2')) {
      return [
        'Image manipulations for the GD toolkit cannot run because the GD toolkit is not available.',
      ];
    }
    return parent::checkRequirements();
  }

Proposed resolution

  • Move the requirement for the imagegd2() function to a @requires annotation.
  • Remove the checkRequirements() method.

Remaining tasks

User interface changes

API changes

Data model changes

Field styling bleeds into node edit forms

$
0
0

Problem/Motivation

The classes applied to fields follow this pattern: field-type-[type] and field-name-[name]

This allows a theme to easily style a particular field or to style a particular type of field.

Unfortunately, the node edit form uses the exact same class names for the field form widgets. Completely different HTML (rendered field vs. form widget), but the exact same class. This is super problematic as any moderately complex field styling can break the corresponding field widget when adding or editing a node.

The classes on the node edit form's field widget containers are to "aid in theming", but they do the opposite. In order to style the field widgets, you first have to undo the styling for the rendered field and then apply the desired widget styling. Even if you don't want special widget styling, you still have to undo the rendered field styling. :-p

Proposed resolution

Change the classes used on the field widget containers created in field_default_form(). There's no reason to use the same class. The easiest way is to prepend form- to the class names, so on the node edit form, they'd be: form-field-type-[type] and form-field-name-[name].

API changes

This will change the class names on field widget containers. But that's the point. They are currently "broken" by anyone's definition.

This fix is done in the Zen theme here: https://git.drupalcode.org/project/zen/blob/7.x-6.x/template.php#L563

Submitting a comment in the non default language redirects you to the default language

$
0
0

Problem/Motivation

In a multilingual site if you add a comment on a node which is in the default language, everything is okay.
But if you add a comment on a node which is not in the default language, I get redirected to the default language translation of the node.

This is very confusing for the end user and they should stay in the same node language after submitting a comment.

Steps to reproduce the issue

This is very easy to replicate on simplytest.me (choose multilingual setup).

If simplytest.me is down (as it currently appears to be), use the following:

  1. $ composer create-project drupal-composer/drupal-project:8.x-dev some-dir --stability dev --no-interaction
  2. install Drupal (for example, use drush si to install Drupal in Italian):
    $ drush si standard \
      --db-url='mysql://root@127.0.0.1/some_dir' \
      --account-name="Kay V" --account-pass=silly.walk.ministry \
      --site-name=Some-Dir \
      --site-mail=noreply@example.com \
      --locale=it
  3. add other languages (e.g. Chinese (simplified), French & English) via UI at admin/config/regional/language
  4. otherwise leave defaults (e.g. skip enabling language switching block; leave Detection and selection method as Url; leave language prefixes unchanged)
  5. add an article in the default language (by default the article content type includes all entity requirements involved in this bug report) /node/add/article
  6. add a comment to the article and hit save
  7. note whether a language prefix appears in the url (no prefix should be there, as this is the default language)
  8. create a new article in another language by entering a different prefix in the url e.g. /en/node/add/article
  9. add a comment to the article and hit save
  10. note again whether a language prefix appears in the url (if the issue exists, the prefix will be missing)
  11. apply patch
  12. drop db tables
  13. repeat from step 2 above

Proposed resolution

Redirect the user to the node translation where the comment is made.

Remaining tasks

Do the patch.

User interface changes

None.

API changes

None.

Data model changes

None.

Current element values missing from vertical tabs when shown in 2-column layout

$
0
0

Problem/Motivation

One of the most awesome benefits of adding vertical tabs in Drupal 7 was the javascript that allowed people to see what the current values were without having to pop-open the fieldsets. This benefit has been lost by moving the tabs to the right hand column.

I did a little research into the development of this new display of vertical tabs, and it looks like the current values are supposed to be present - at least according to the screenshots shown in this issue - the one that got committed.

Missing summaries

Perhaps they were forgotten, or removed later for some other reason?

Proposed resolution

Put back the awesomeness that was vertical tabs - javascript revealing current values from within fieldsets. In Drupal 7.38 it's handled in /misc/collapse.js, line 56-101, propably doesn't work one-by-one to D8.

Remaining tasks

see above

User interface changes

see above

API changes

none

#1936700: Book module usability improvements


Content moderation check does not take into account entity IDs being used by two content entities

$
0
0

Apologies if this belongs in the content moderation component. I figured it's linked more to the experimental workspaces functionality.

I'm currently working on a fix and will attach a patch.

Problem/Motivation

The check in content_moderation_workspace_access() in the content_moderation module where tracked revisions are queried for their moderation state does not take into account the entity type. This causes an issue where an id/vid is shared by more than one entity type.

As an example - here a path alias has a revision ID of 9146.

*************************** 1. row ***************************
                workspace: xyz
    target_entity_type_id: path_alias
         target_entity_id: 9141
target_entity_revision_id: 9146

We also have a node with vid 9146 which is not tacked in a workspace:

*************************** 1. row ***************************
               nid: 1656
               vid: 9146
          langcode: en
      revision_uid: 86
revision_timestamp: 1579865672
      revision_log: NULL
  revision_default: 1
         workspace: NULL

The path alias revision ID makes it's way into $tracked_revision_ids in

  // Check if any revisions that are about to be published are in a non-default
  // revision moderation state.
  $query = $entity_type_manager->getStorage('content_moderation_state')->getQuery()
    ->allRevisions()
    ->accessCheck(FALSE);
  $query->condition('content_entity_revision_id', $tracked_revision_ids, 'IN');

which is not aware of entity type. This returns this row and prevents the workspace from publishing:

*************************** 1. row ***************************
                           id: 2096
                  revision_id: 10441
                     langcode: en
                          uid: 86
                     workflow: fca_workflow
             moderation_state: draft
       content_entity_type_id: node
            content_entity_id: 1656
   content_entity_revision_id: 9146
             default_langcode: 1
revision_translation_affected: 1

Proposed resolution

Tweak content_moderation_workspace_access() to utilise content_entity_type_id.

Remaining tasks

  1. Create patch
  2. Test
  3. Review

Move the by core supported database drivers to their own module

$
0
0

Problem/Motivation

At the moment there are a lot of problems when you are the developer/maintainer of a contrib database driver. Normally when you are working on a contrib module and you have a problem, you look at how something similar is solved by the by core supported modules and use that solution for you contrib module. The problem for contrib database driver developers/maintainers is that solution does not work for them. In Drupal core there are a lot of specific for a database driver exceptions. Contrib database drivers are not allowed (for good reasons) to have the same exception added in core. That makes solving some problems almost impossible for contrib database drivers.

Proposed resolution

Move the by core supported database drivers to their own module (this issue). In following issues the specific exceptions in core for the by core supported database driver will be moved to the module part of the database drivers. When doing so we need to solve how to have those exception in a module instead of in regular core code. When do this for the by core supported database driver, the contrib database drivers can use the same solution.

Remaining tasks

TBD

User interface changes

None

API changes

The Database API and the Schema API are part of the public API. The implementation of those API's by the by core supported database drivers (MySQL, PostgreSQL and SQLite) are however NOT part of the public API. Therefor this patch does not contain any API changes.

Data model changes

None

Release notes snippet

TBD

Changing language of a node should change language of menu link, not create translation

$
0
0

When you change the language of a node, and there is a menu link for that node, then a translation of the menu link into the new language is automatically created. That's nice, but it's weird that the first translation of the menu link stays too.

  1. Install node, menu_ui and content_translation
  2. Add a second language, e.g. Swedish (admin/config/regional/language)
  3. Enable translation for nodes and menu links (admin/config/regional/content-language)
  4. Create a page in English named "Soup" and check "Provide a menu link"
  5. Check that there is a new menu link and it is only in English (admin/structure/menu/item/1/edit/translations)
  6. Edit the "Soup" page and change its language to Swedish
  7. Check the translations of the menu link

Expected: The menu link should be only in Swedish

Actual: The menu link is in both languages, the original one being in English

I realize there may be cases where the current behavior is the one expected. But my guess is that the expectation quoted above (which btw is directly from a current project of mine) is shared in general.

Allow double quotes for empty media alternative text

$
0
0

If you use a media though the media library that is an image type that has its alternative text mandatory, if you want to use the double quotes pattern to ignore the alt text for an exceptional use case, the alt text rendered will be "" instead of an empty alt text as it would happen to an image inserted via the text editor.

#2307647: [Follow-up] Allow manual override of required image alt text in the Text Editor image dialog when appropriate Is an example of the implementation used for that.

Being consistent to let users insert a media without an alternative text would make more sense.

Deprecate some of the bootstrap.inc PHP-related constants

$
0
0

Problem/Motivation

This is a follow-up to #2843328: Enforce minimum PHP version in composer dependencies

In that issue, we learned that it's hard to unit-test against the minimum PHP requirement for Drupal.

That's because the DRUPAL_MINIMUM_PHP constant lives in core/includes/bootstrap.inc, which is not autoloadable in unit tests.

This is also true of DRUPAL_MINIMUM_PHP_MEMORY_LIMIT.

This kind of awkward constant definition leads to the solution in #2843328: Enforce minimum PHP version in composer dependencies which is to define a similar constant on the test class, and also to re-definitions of constants as in ThemeHandlerTest.

Also this true of DRUPAL_MINIMUM_SUPPORTED_PHP and DRUPAL_RECOMMENDED_PHP that introduced in #3039287: Implement changes required to remove support for PHP 5.5 and 5.6

Proposed resolution

Deprecate these constants in bootstrap.inc.

Move the constants to an appropriate autoloadable class. This could be in the installer system or \Drupal, or a constants-only class designed for this purpose.
Update: The chosen solution is to add 4 constants to the class \Drupal.

Remaining tasks

Follow-up to remove usages of deprecated constants.

User interface changes

None

API changes

Deprecates DRUPAL_MINIMUM_PHP, DRUPAL_MINIMUM_SUPPORTED_PHP, DRUPAL_RECOMMENDED_PHP and DRUPAL_MINIMUM_PHP_MEMORY_LIMIT

Adds to the class Drupal the following 4 constants: \Drupal::MINIMUM_PHP, \Drupal::MINIMUM_SUPPORTED_PHP, \Drupal::RECOMMENDED_PHP and \Drupal::PHP_MEMORY_LIMIT

Data model changes

None.

Allow entities to be subclassed using "bundle classes"

$
0
0

Problem/Motivation

Content types are essentially business objects, but we have no standard ability to modify or subclass them to add business logic, which therefore gets scattered among helper services.

This issue introduces the concept of "bundle classes" which are subclassing the current entity classes such as \Drupal\node\Entity\Node. A bundle class is defined using the class property of the entity type bundle info, so modules can define bundle classes for their own entities using hook_entity_bundle_info() and can alter bundle classes of entities defined in other modules with hook_entity_bundle_info_alter().

For example a custom module could provide a bundle class for a node type like this:

use Drupal\mymodule\Entity\BasicPage;

/**
 * Implements hook_entity_bundle_info_alter().
 */
function mymodule_entity_bundle_info_alter(&$bundles) {
  $bundles['node']['page']['class'] = BasicPage::class;
}

The bundle classes themselves extend the entity class:


namespace Drupal\mymodule\Entity;

use Drupal\node\Entity\Node;

class BasicPage extends Node implements BasicPageInterface {

  // Implement whatever business logic specific to basic pages.
  public function getBody() {
    return $this->get('body')->value;
  }

}

The entity type manager will always return bundle classes if possible, so we can rely on the data types rather than having to call $entity->bundle():

$entity = $this->entityTypeManager->getStorage('node')->load($id);
if ($entity instanceof BasicPageInterface) {
  // Some logic which applies only to basic pages.
)

Remaining tasks

Reviews

User interface changes

None

API changes

None

Data model changes

None

Original summary by larowlan

Content types are essentially business objects, but we have no standard ability to modify or subclass them to add business logic, which therefore gets scattered among helper services.

We can't safely modify the defaults under the current system, because we have lots of places where entity storage determines the entity class using $this->entityClass. If something like Entity Bundle Plugin were to try and sub-class sql content entity storage it would need to override each of these calls.

Example use case

Details generalized from a real past project: I'm building a website for a popular trading card game. Each trading card has its own page, displaying its type (character, trainer, or special), properties such as hit points and attack strength, and (in the case of characters) evolution chain. I want to be able to encode specialized business logic in entity class methods I can call on the theme layer and elsewhere to do things like getting the node ID of the next card in a series or generating an evolution chain. I want this logic centralized in the business object--not scattered across integrating subsystems--as a matter of code quality and DX. To illustrate the difference, if I can extend Node with CharacterTradingCardNode and add an evolutionChain() method right on it, I can embed the business logic right in the class and directly access it anywhere I have that type of node, such as a Twig file. If not, I have to create a separate service for the business logic and inject its output into the context I want to use it in.

Pseudocode with Subclassing (The Proposal)
<!-- node-character_trading_card.html.twig -->
<ul>
  {% for evolution in node.evolutionChain %}
    <li>{{ evolution.id }}</li>
  {% endfor %}
</ul>
Pseudocode without Subclassing (The Present)
# mytheme.theme
function mytheme_preprocess_node(&$variables) {
  if ($variables['node'] && $variables['node']->bundle() === 'character_trading_card') {
    $evolution_chain_generator = \Drupal::service('mymodule.evolution_chain_generator');
    $variables['evolution_chain'] = $evolution_chain_generator->generateChain($variables['node']);
  }
}
<!-- node-character_trading_card.html.twig -->
<ul>
  {% for evolution in evolution_chain %}
    <li>{{ evolution.id }}</li>
  {% endfor %}
</ul>

Proposed resolution

Put access to the entity class behind a protected method, passing the bundle when available.
This is generally considered better for refactoring too.

Enhance Toolbar's subtree caching so that menu links with CSRF token do not need one subtree cache item per session

$
0
0

I ran into the issue of admin_toolbar_tools being incompatible with dynamic page cache - #2897309: admin_toolbar_tools module makes all pages uncacheable. After some debugging I figured the cause are the CSRF tokens in the links. However those where already correctly place-holdered, still they ended up being rendered too early causing the 'session' cache context being added in, making the requests uncachable.

Turns out, problem is that toolbar forces replacing placeholders. Fixing that resolves the problem admin_toolbar_tools and it works just fine.


How to assign css class to character inserted using "special char" button

$
0
0

I am trying to automatically assign a specific css class to special characters, which our editors can insert using the special char button. We already enhanced ckeditor with the module ckeditor_specialchars to add additional characters. The class is required to format these chars with a special webfont that includes them. So I would love to automate the step of selecting each character and assigning a format.

Does anybody have an idea how I could solve this? Thanks in advance.

Duplicated rows on admin/content if author is translated

$
0
0

Problem/Motivation

- Install with Standard profile in English.
- Turn on the 4 multilingual modules.
- Add Spanish language.
- Make Node translatable (both content types), and User.
- Add an English Article node translated to Spanish, and a Spanish Page node
translated to English.
- Translate User 1 into Spanish

Now go to admin/content. You will see 2 copies of each translation in the table. This is really pretty horrible.

Screen shot of admin/content after following the steps above

The reason, I think, is that there is probably a join between node and user in this view, which multiplies the number of rows because both node and user have 2 entries per item in the field data tables.

Proposed resolution

Fix it so that there is only one copy of each translation in the table. I have no idea how to do this.

Remaining tasks

Make a patch. test it.

User interface changes

No duplicate rows.

API changes

Probably not.

Data model changes

Shouldn't be.

Replace drupal_valid_test_ua() and drupal_generate_test_ua() with static methods

$
0
0

drupal_valid_test_ua() and drupal_generate_test_ua() should be removed with a modern approach.

Using magic preprocess hooks messes up template suggestions order

$
0
0

Problem/Motivation

If you create a magic preprocess suggestion like:

function MYMODULE_preprocess_node__event(&$variables) {}

Yet you do not have a template `node--event.html.twig`, `node__event` is still added to the registry in `Drupal\Core\Theme\Registry`, but the cached data in the build method sets it to the default 'node.html.twig'.

This becomes a problem if you then subsequently want to template a view mode in your theme, eg, `node--teaser.html.twig`. `node__teaser` is a valid suggestion with higher priority according to the comments

FILE NAME SUGGESTIONS:
   * node--1--teaser.html.twig
   * node--1.html.twig
   * node--event--teaser.html.twig
   * node--event.html.twig
   * node--teaser.html.twig
   x node.html.twig

However, `node.html.twig` will still be selected because the result of `Drupal\Core\Theme\Registry::build()` will contain a key `node__event` pointing at `node.html.twig` at a higher specificity than `node--teaser.html.twig`

Proposed resolution

Prevent automatically adding to theme registry build if no template matches the specificity of the preprocess hook.

Remaining tasks

Determine how to approach this.

User interface changes

None

API changes

None

Data model changes

None

Release notes snippet

Fix an edge case theme registry issue when using magic template preprocess suggestions

PDOException: Syntax error or access violation: 1305 SAVEPOINT savepoint_1 does not exist

$
0
0

I am getting this error with 7.15. They are consistently happening in pairs. I'm using mysql. Note this is

php

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1305 SAVEPOINT savepoint_1 does not exist: ROLLBACK TO SAVEPOINT savepoint_1; Array ( ) in file_usage_add() (line 661 of /var/www/website.com/includes/file.inc).

node

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1305 SAVEPOINT savepoint_1 does not exist: ROLLBACK TO SAVEPOINT savepoint_1; Array ( ) in file_usage_add() (line 661 of /var/www/buyagainbaby.com/includes/file.inc).

I originally posted about this in a related thread http://drupal.org/comment/edit/6556106.

Viewing all 296841 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>