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

Unpublished content is not visible in views to users with the 'view own unpublished content' permission when used in combination with node grants

$
0
0

Problem/Motivation

When Content Moderation is enabled and a user with 'view own unpublished content' creates a new piece of content and saves it in the 'draft' state they cannot see that content in either the Content Overview (Node) /admin/contentor the Managed Content (Content Moderation) admin/content/moderatedViews.

This occurs because if (a) any module implements hook_node_grants then access to the node is conditional based on if a record exists in the node_access table which (b) doesn't occur unless a node is published or another module sets access records for draft content, which Content Moderation does not do.

a) node_access_view_all_nodes docroot/core/modules/node/node.module:1014

  // If no modules implement the node access system, access is always TRUE.
  if (!\Drupal::moduleHandler()->getImplementations('node_grants')) {
    $access[$account->id()] = TRUE;
  }
  else {
    $access[$account->id()] = \Drupal::entityManager()->getAccessControlHandler('node')->checkAllGrants($account);
  }

b) \Drupal\node\NodeAccessControlHandler::acquireGrants called from \Drupal\node\Entity\Node::postSave

/**
   * {@inheritdoc}
   */
  public function acquireGrants(NodeInterface $node) {
    $grants = $this->moduleHandler->invokeAll('node_access_records', [$node]);
    // Let modules alter the grants.
    $this->moduleHandler->alter('node_access_records', $grants, $node);
    // If no grants are set and the node is published, then use the default grant.
    if (empty($grants) && $node->isPublished()) {
      $grants[] = ['realm' => 'all', 'gid' => 0, 'grant_view' => 1, 'grant_update' => 0, 'grant_delete' => 0];
    }
    return $grants;
  }

However if a module does implement hook_node_grants, the only way the content will appear in the Content Overview View (for non-admin users) is if it published.

Steps to reproduce

  • Install Drupal 8.5.3
  • Install a module that implements hook_node_grants i.e Content Access or Permissions by Term
  • Enable Content Moderation (and it's dependency Workflows)
  • Edit 'Editorial' workflow to apply to all content types
  • Create a new use role 'Editor' with the following permissions:
  • 'access content''access content overview''create article content''delete all revisions''delete any article content''delete article revisions''delete own article content''edit any article content''edit own article content''grant content access''grant own content access''revert all revisions''revert article revisions''use editorial transition archive''use editorial transition archived_draft''use editorial transition archived_published''use editorial transition create_new_draft''use editorial transition publish''view all revisions''view any unpublished content''view article revisions''view latest version''view own unpublished content'
  • Create a new user 'editor'
  • Log in as the new user
  • Create a new 'article' with the title "[TEST] Title" with the "Save As" value "Draft" selected
  • Go to the Content Overview View (/admin/content)
    • No content is shown
  • Go to Moderated Content View (admin/content/moderated)
    • No content is shown
  • Edit the "[TEST] Title" node (/node/1)
  • Set the "Change to" field value to "Published"
  • save
  • Go to the Content Overview View (/admin/content)
  • You should see [TEST] Title with the Status Published
  • Go to Moderated Content View (admin/content/moderated)
  • You should not see [TEST] Title
  • Edit the "[TEST] Title" node (/node/1)
  • Set the "Change to" field value to "Draft"
  • Go to Moderated Content View (admin/content/moderated)
  • You should see [TEST] Title with the status

Proposed resolution

I'm not sure where the solution for this needs to occur but I feel like the implications of getting it wrong could have wide reaching consequences.

Does an extra conditional need to be added to \Drupal\node\NodeAccessControlHandler::acquireGrants to check for Content Moderation and set the same defaults, if none are set, or should Content Moderation implement hook_node_access_records?

Considering Content Moderation is now part of core I think adding a check for it and setting similar defaults as published content isn't a bad thing. Of course the 'gid' would need to be set using the users role, but would this allow other roles with more perms to access the content? This approach would also mean a test could be added in Content Moderation for the Content Overview View checking for draft visibility

I'm leaning more towards Content Moderation implementing hook_node_grants and hook_access_records - but that is where I wanted to find some validation from the community that this approach is going to be acceptable.

Remaining tasks

  • Determine the best approach for handling this.
  • Add/update tests in Content Moderation
  1. so that the Views being tested against exactly match the default views.view.moderated_content, currently none of the test Views in content_moderation_test_viewshave the same access setting as content_moderation
  2. add test coverage for draft content in Content Overview

Convert admin UI-related modules: contextual, help, inline_form_errors, quickedit, settings_tray, shortcut, toolbar, tour module hook_help() to topic(s)

$
0
0

Problem/Motivation

#3041924: [META] Convert hook_help() module overview text to topics for the admin UI-related modules: contextual, help, inline_form_errors, quickedit, settings_tray, shortcut, toolbar, tour module(s).

Proposed resolution

Take the information that is currently in the hook_help module overview section for the module(s), and make sure the information is in one or more Twig help topic files. Steps:

  1. Find the hook_help() implementation function in the core/modules/MODULENAME/MODULENAME.module file(s). For example, for the core Contact module, the module files is core/modules/contact/contact.module, and the function is called contact_help().
  2. Locate the module overview portion of this function. This is located just after some lines that look something like this:
      switch ($route_name) {
        case 'help.page.contact':
    

    And ends either at the end of the function, or where you find another case 'something': line.

  3. We want to end up with one or more topics about the tasks that you can do with this module, and possibly a section header topic. So, read the help and figure out a good way to logically divide it up into tasks and sections. See Standards for Help Topics for information on how to do this.
  4. See if some of these tasks are already documented in existing topics. Currently, all topics are in core/modules/help_topics/help_topics. Note that to see existing topics, you will need to enable the experimental Help Topics module (available in the latest dev versions of Drupal 8.x).
  5. For each task or section topic that needs to be written, make a new Twig topic file (see Standards for Help Topics) in core/modules/help_topics/help_topics. You will need to choose the appropriate module prefix for the file name -- the module that is required for the functionality. Alternatively, if the information spans several modules or if the information should be visible before the module is installed, you can use the "core" file name prefix. For instance, it might be useful to know that to get a certain functionality, you need to turn on a certain module (so that would be in the core prefix), but then the details of how to use it should only be visible once that module is turned on (so that would be in the module prefix).
  6. File names must be MODULENAME.TOPICNAME.html.twig -- for example, in the Action module, you could create a topic about managing actions with filename action.managing.html.twig (and "MODULENAME" can be "core" as discussed above).
  7. Make a patch file that adds/updates the Twig templates. The patch should not remove the text from the hook_help() implementation (that will be done separately).

Remaining tasks

a) Make a patch (see Proposed Resolution section).

b) Review the patch:

  1. Apply the patch.
  2. Turn on the experimental Help Topics module in your site, as well as the module(s) listed in this issue.
  3. Visit the page for each topic that is created or modified in this patch. The topics are files in the patch ending in .html.twig. If you find a file, such as core/modules/help_topics/help_topics/action.configuring.html.twig, you can view the topic at the URL admin/help/topic/action.configuring within your site.
  4. Review the topic text that you can see on the page, making sure of the following aspects:
    • The text is written in clear, simple, straightforward language
    • No grammar/punctuation errors
    • Valid HTML -- you can use http://validator.w3.org/ to check
    • Links within the text work
    • Instructions for tasks work
    • Adheres to Standards for Help Topics [for some aspects, you will need to look at the Twig file rather than the topic page].
  5. Read the old "module overview" topic(s) for the module(s), at admin/help/MODULENAME. Verify that all the tasks described in these overview pages are covered in the topics you reviewed.

User interface changes

Help topics will be added to cover tasks currently covered in modules' hook_help() implementations.

API changes

None.

Data model changes

None.

Release notes snippet

None.

Select All media option is missing while adding media in Table format

$
0
0

Step to Reproduce

1. Add media as reference field in Basic Page content type.(Allow unlimited)
2. Add basic page content.
3. While adding basic page in media section click Add Media
4. Then select Table as format.
5. In 1st column select all checkbox is missing.

My idea is that it's good to provide select all option to end user when media entity is more than 1.

IncludeResolver not returning correct version data for moderated content references

$
0
0

When trying to access the working revision entity data with resourceVersion=rel:working-copy and using includes, the current revision of the referenced entities is being returned by the method "resolveIncludeTree" in IncludeResolver class. This method should return the data as per the revision being passed in the API query or the working revision.

Replace the term 'Block' when talking about Layout Builder

$
0
0

I'm currently wading through all the Layout Builder contrib modules I can find that improve the UI/UX but I'm finding some things really need to be addressed at the core of it.

One example is the term ‘blocks’. It is (in my opinion) used in a confusing way throughout Layout Builder, especially if you need to give an editor (non-developer) the tools to build up their own layouts.
The elements added to a region are NOT all blocks at their core. They are just RENDERED as a block. So yes, technically, we have fields, views, paragraphs (depending of some contrib modules), etc… that show up in the front-end inside a block but when they are added via the off-canvas modal to a region's template area, they are all different kinds of elements: fields, views, blocks, … They are not blocks until they are rendered.

This kind of terminology is confusing to non-dev users and brings more ammo to the age-old discussion of Drupal not being very user-friendly for non-devs. One stop-gap measure (in my opinion), would be renaming the 'Add block' link and other references to something like ‘Add as a block’ or ‘Render as a block’ or even better: ‘Add item’.

Revisions/Drafts of Content Moderation Module not viewable until after node published at least once

$
0
0

Someone explained the issue I am having very well at the following page: https://www.drupal.org/project/drupal/issues/2971902

I have configured the workflow/content administration setup. However, ONLY the admin user (original user) can use the workflow.

All other users cannot use the workflow b/c it seems no grant setting is established until after the node is published (defeating the purpose)

Is there any workaround?

I would think that I could write a custom module to manually add some default grant on save but that might be over my head at this point.

Fix misspellings in Twig comments

$
0
0

Problem/Motivation

The Views module Twig files have "whtether" misspelled three times and "CSS" should be all caps like "HTML" in the line above it.

Tables overflow on mobile

$
0
0

Problem/motivation

Currently there is a overflow/scrollbar for the entire page, if the page is viewed on a mobile device and the page contains a table.

Proposal

We introduce the "overflow-x: scroll;" CSS declaration to remove the overflow. So only the table will be horizontally scrollable and the other content will suite the viewport.


Move search text processing to a service

$
0
0

Problem/Motivation

Follow up to #3075695: Move search_index() and related functions to a service there are a number of text processing/tokenisation functions that can be moved to a service and deprecated. This includes:

  • search_index_split()
  • search_simplify()
  • search_expand_cjk()

Proposed resolution

Move them to a SearchTokenizer service and deprecate.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Content Moderation requirements check relies on Views UI module

$
0
0

After updating to Drupal 8.8.0, the Status Report (/admin/reports/status) throws a 500 error with the exception --

Uncaught PHP Exception Symfony\Component\Routing\Exception\RouteNotFoundException: "Route "entity.view.edit_form" does not exist."

This will happen if the Views UI module is not installed and a view is found to be a using the deprecated moderation_state value in content_moderation_requirements because it attempts to create a route provided by the Views UI module (entity.view.edit_form).

Workaround for now is to enable Views UI.

Add per-bundle unpublished content permissions

$
0
0

Problem/Motivation

By default content moderation module gives View any unpublished content permission to view the all the unpublished content in the site. But we shouldn't able to restrict the unpublished content view access of particular content type. So this will be too permissive when complex workflows enanled.

Proposed resolution

Per bundle unpublished permission
Add view any unpublished [ENTITY_TYPE:BUNDLE] content permissions.

Remaining tasks

  • Make the code change
  • Add tests

User interface changes

API changes

Data model changes

Convert appearance-related modules: breakpoint, color, layout_builder, layout_discovery, field_layout module hook_help() to topic(s)

$
0
0

Problem/Motivation

#3041924: [META] Convert hook_help() module overview text to topics for the breakpoint, color, layout_builder, layout_discovery, and field_layout modules.

Also the parts of the system module related to installing/uninstalling/configuring themes.

Proposed resolution

Take the information that is currently in the hook_help module overview section for the module(s), and make sure the information is in one or more Twig help topic files. Steps:

  1. Find the hook_help() implementation function in the core/modules/MODULENAME/MODULENAME.module file(s). For example, for the core Contact module, the module files is core/modules/contact/contact.module, and the function is called contact_help().
  2. Locate the module overview portion of this function. This is located just after some lines that look something like this:
      switch ($route_name) {
        case 'help.page.contact':
    

    And ends either at the end of the function, or where you find another case 'something': line.

  3. We want to end up with one or more topics about the tasks that you can do with this module, and possibly a section header topic. So, read the help and figure out a good way to logically divide it up into tasks and sections. See Standards for Help Topics for information on how to do this.
  4. See if some of these tasks are already documented in existing topics. Currently, all topics are in core/modules/help_topics/help_topics. Note that to see existing topics, you will need to enable the experimental Help Topics module (available in the latest dev versions of Drupal 8.x).
  5. For each task or section topic that needs to be written, make a new Twig topic file (see Standards for Help Topics) in core/modules/help_topics/help_topics. You will need to choose the appropriate module prefix for the file name -- the module that is required for the functionality. Alternatively, if the information spans several modules or if the information should be visible before the module is installed, you can use the "core" file name prefix. For instance, it might be useful to know that to get a certain functionality, you need to turn on a certain module (so that would be in the core prefix), but then the details of how to use it should only be visible once that module is turned on (so that would be in the module prefix).
  6. File names must be MODULENAME.TOPICNAME.html.twig -- for example, in the Action module, you could create a topic about managing actions with filename action.managing.html.twig (and "MODULENAME" can be "core" as discussed above).
  7. Make a patch file that adds/updates the Twig templates. The patch should not remove the text from the hook_help() implementation (that will be done separately).

Remaining tasks

a) Make a patch (see Proposed Resolution section).

b) Review the patch:

  1. Apply the patch.
  2. Turn on the experimental Help Topics module in your site, as well as the module(s) listed in this issue.
  3. Visit the page for each topic that is created or modified in this patch. The topics are files in the patch ending in .html.twig. If you find a file, such as core/modules/help_topics/help_topics/action.configuring.html.twig, you can view the topic at the URL admin/help/topic/action.configuring within your site.
  4. Review the topic text that you can see on the page, making sure of the following aspects:
    • The text is written in clear, simple, straightforward language
    • No grammar/punctuation errors
    • Valid HTML -- you can use http://validator.w3.org/ to check
    • Links within the text work
    • Instructions for tasks work
    • Adheres to Standards for Help Topics [for some aspects, you will need to look at the Twig file rather than the topic page].
  5. Read the old "module overview" topic(s) for the module(s), at admin/help/MODULENAME. Verify that all the tasks described in these overview pages are covered in the topics you reviewed.

User interface changes

Help topics will be added to cover tasks currently covered in modules' hook_help() implementations.

API changes

None.

Data model changes

None.

Release notes snippet

None.

Nested Paragraphs create multiple drag handles

$
0
0

Problem:

Using nested paragraphs creates multiple drag handles for sub-paragraph field.

What it looks like:
multiple drag handles

Steps to reproduce:
1. Create a new paragraph type (sub paragraph) (can be empty without fields)
2. Create two other paragraphs (main paragraphs) (the other one can be empty without fields)
3. Add a Paragraph field to the other main paragraph and include to sub paragraph in the reference type.
4. Add a Paragraph field to basic page and include the two main paragraphs in the reference type
5. Add a basic page and add there the paragraph type which has the sub field. It shows the three drag handles for the sub paragraph

This seems to be an issue in the Claro tabledrag, which has overriden the core tabledrag, because this doesn't happen with Seven administration theme. It seems that the Claro tabledrag.js is adding some wrappers and other divs to the html so that we end up with 3 drag handles. The problem doesn't come up with any other place in admin UI, but the nested paragraphs use the "multiple drag".

The difference seems to be here:

The output for the Seven admin theme:

<td class="field-multiple-drag">
  <a href="#" class="tabledrag-handle" title="Drag to re-order">
    <div class="handle">&nbsp;</div>
  </a>
</td>

And the output for the Claro theme:

<td class="field-multiple-drag tabledrag-cell tabledrag-cell--only-drag">
  <div class="tabledrag-cell-content js-tabledrag-cell-content">
    <a href="#" class="tabledrag-handle js-tabledrag-handle" title="Drag to re-order"></a>
    <div class="tabledrag-cell-content__item">
      <div class="tabledrag-cell-content js-tabledrag-cell-content">
        <a href="#" class="tabledrag-handle js-tabledrag-handle" title="Drag to re-order"></a>
        <a href="#" class="tabledrag-handle js-tabledrag-handle menu-item__link" title="Drag to re-order"></a>
          <div class="tabledrag-cell-content__item"></div>
      </div>
    </div>
  </div>
</td>

It adds the handle three times.

Avoid error when $options is NULL in buildUrl()

$
0
0

We've run into an issue where we are getting an error on a link field:

Error: Unsupported operand types in /core/modules/link/src/Plugin/Field/FieldFormatter/LinkFormatter.php on line 245

I don't know if it's possible to reproduce this error with just core. The error seems to be coming from a translation issue in Paragraphs where the "options" property isn't getting set right. This patch is a work-around to that but it's just checking that $options is an array and making it one if it's not so it won't hurt anything to have it in there as a failsafe.

Update core JavaScript dependencies listed in package.json

$
0
0

Problem/Motivation

We should update all of core's remaining JavaScript dependencies prior to 9.0.0-beta1, including any major version updates that may be available. This includes dependencies listed in package.json.

Proposed resolution

Here's a table of all core JavaScript dependencies in the package.json, and the latest versions of the packages.

Major

PackageCurrentWantedLatestURL
chalk2.4.22.4.23.0.0https://github.com/chalk/chalk#readme
chokidar2.1.62.1.83.3.1https://github.com/paulmillr/chokidar
chromedriver75.1.075.1.079.0.0https://github.com/giggio/node-chromedriver
cross-env5.2.05.2.16.0.3https://github.com/kentcdodds/cross-env#readme
dotenv-safe5.0.15.0.18.2.0https://github.com/rolodato/dotenv-safe#readme
eslint4.19.14.19.16.8.0https://eslint.org
eslint-config-airbnb17.1.117.1.118.0.1https://github.com/airbnb/javascript
eslint-config-prettier2.10.02.10.06.9.0https://github.com/prettier/eslint-config-prettier#readme
eslint-plugin-prettier2.7.02.7.03.1.2https://github.com/prettier/eslint-plugin-prettier#readme
eslint-plugin-react-hooks1.7.01.7.02.3.0https://reactjs.org/
stylelint9.10.19.10.112.0.1https://stylelint.io
stylelint-config-standard18.3.018.3.019.0.0https://github.com/stylelint/stylelint-config-standard#readme
stylelint-order2.2.12.2.14.0.0https://github.com/hudochenkov/stylelint-order
terser4.4.34.5.14.5.1https://terser.org

Minor

PackageCurrentWantedLatestURL
autoprefixer9.6.19.7.39.7.3https://github.com/postcss/autoprefixer#readme
eslint-plugin-import2.18.22.19.12.19.1https://github.com/benmosher/eslint-plugin-import
eslint-plugin-react7.14.37.17.07.17.0https://github.com/yannickcr/eslint-plugin-react
nightwatch1.2.11.3.21.3.2http://nightwatchjs.org
prettier1.18.21.19.11.19.1https://prettier.io

Patch

PackageCurrentWantedLatestURL
glob7.1.47.1.67.1.6https://github.com/isaacs/node-glob#readme
postcss7.0.187.0.267.0.26https://postcss.org/

Remaining tasks


Allow a button in an exposed forms to trigger ajax.

Expected type hint "GetResponseEvent"; found "FilterResponseEvent" for $event

Wrong PHPDoc for Map::setValue & Map::writePropertyValue

$
0
0

Problem/Motivation

Current PHPDoc for Map::setValue is incomplete ($notify param is not documented) and it doesn't provide relevant information. At Map::writePropertyValue throws are not documented.

Proposed resolution

Review doc.

Remaining tasks

Review.

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

Not required.

Type hint "\Drupal\Core\Session\AccountInterface" missing

Add GUI to configure the site's logo alt attribute

$
0
0

Problem/Motivation

When I add logo img to sites I don't get a ALT && Title field as I would get when adding an image_field to nodes.

Proposed resolution

Thus, it seems there is no simple GUI way to add these; By now I myself added them through the twig, but I humbly suggest adding these fields as ensuring valid usage of Drupal for all users. Also, they're quite important for SEO.

Sending people to add these from at the SQL or by an external module should be avoided, I think.

Remaining tasks

The tests that were added need reviewing by someone experienced with tests.

We still need to decide whether we should reference the newly created variables in the twig templates or just stick with the markup defined in variables content ie:

Option 1 (current patch):

$variables['site_logo_alt'] = $variables['content']['site_logo_alt']['#markup'];
$variables['site_logo_title'] = $variables['content']['site_logo_title']['#markup'];

Versus Option 2 (proposed in #23, saying we should maybe not create new variables, and just reference the markup from the existing $variables['content'])

$variables['content']['site_logo_alt']['#markup'];
$variables['content']['site_logo_title']['#markup'];

In #30 it's suggested that using option 1 is okay. Option 1 makes it so we lose the #access part of the render array. If you look at other variables like 'site_name', and 'site_slogan', they do not have the #access part of the render array. Here's an example of some other variables that don't have #access:

'site_logo' => string(35) "/drupal/core/themes/bartik/logo.svg"'site_logo_alt' => string(0) ""'site_logo_title' => string(0) ""'site_name' => string(6) "Drupal"'site_slogan' => string(0) ""

Completed Tasks

Configuration for the logo alt attribute and title attribute has been added in two cases:
1) When you use the default logo
2) When you upload your own custom logo

The system branding block has been updated to support the logo alt and logo title attributes in the Bartik, Classy and Stable themes.

Testing for saving the alt attribute and title attribute has been added in a patch in https://www.drupal.org/node/2780293#comment-12061662 (#40). Testing to ensure the alt and title attributes show in the branding block have been added in patch https://www.drupal.org/node/2780293#comment-12073031 (#45)

@rovo: has tested accessibility via Wave in #34

Viewing all 291246 articles
Browse latest View live


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