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

TypeError: Argument 1 passed to options_allowed_values() must implement interface Drupal\\Core\\Field\\FieldStorageDefinitionInterface, null given, called in /core/modules/options/src/Plugin/views/filter/ListField.php

$
0
0

I don't know if I've found a bug or if I'm doing something wrong. I'm taking the conservative approach and filing this as a support request.

I've got an entity that is defined as such.

My views data is defined as such.

I want to filter on the article status. Its field type is list_string. The Views filter handler is defined as list_field. When I select that field as a filter I get the error message TypeError: Argument 1 passed to options_allowed_values() must implement interface Drupal\\Core\\Field\\FieldStorageDefinitionInterface, null given, called in /core/modules/options/src/Plugin/views/filter/ListField.php

To check out an example that works:
I have added a field to the Basic page content type that is defined as in the attached file.
I created a view that filters on that field that is defined as in the attached file.
I can see that the field is of type list_string and that the view filter handler is of type list_field.

To me it would appear that I've got everything defined the same as the working example for my entity.

What gives?

I've included an issue that may or may not be related.


Unique field constraint does not work with entity reference fields

$
0
0

Problem/Motivation

Adding a constraint of UniqueField to an entity reference field does not enforce that the field value is unique.

One was added by:

function hook_entity_bundle_field_info_alter(&$fields, EntityTypeInterface $entity_type, $bundle) {
  if (!empty($fields['field_some_reference'])) {
    $fields['field_some_reference']->addConstraint('UniqueField', [
      'message' => 'An entity reference %value already exists.'
    ]);
  }
}

Proposed resolution

The problem seems to stem from UniqueFieldValueValidator.php on line 30.

$value_taken = (bool) \Drupal::entityQuery($entity_type_id)
    // The id could be NULL, so we cast it to 0 in that case.
    ->condition($id_key, (int) $items->getEntity()->id(), '<>')
    ->condition($field_name, $item->value)
    ->range(0, 1)
    ->count()
    ->execute();

$item->value returns nothing for an entity reference field even if a value is present.

Being that it's not the only field type that behaves this way, I am not sure what the best approach is that will cover all field types.

Taxonomies can fail on import during migration if date isn't formatted properly

$
0
0

Hello

We are performing a D8 migration via Migrate Source CSV. In our yaml, we are using the format_date plugin to convert the created date on a node from a timestamp to iso. On top of this, we are migrating a tid to its corresponding tid on drupal 8. Pretty simple stuff, but it kept imploding on our taxonomy field with messages like:

 [notice] Processed 1 item (0 created, 0 updated, 0 failed, 1 ignored) - continuing with 'node_proposal_part_csv'
 [error]  Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[01000]: Warning: 1265 Data truncated for column 'created' at row 1: UPDATE {taxonomy_index} SET sticky=:db_update_placeholder_0, created=:db_update_placeholder_1
WHERE (nid = :db_condition_placeholder_0) AND (tid = :db_condition_placeholder_1) AND (status = :db_condition_placeholder_2); Array
(
    [:db_update_placeholder_0] => 0
    [:db_update_placeholder_1] => 2010-01-26T01:06:01
    [:db_condition_placeholder_0] => 10708
    [:db_condition_placeholder_1] => 18
    [:db_condition_placeholder_2] => 1
)
in taxonomy_build_node_index() (line 553 of /app/web/core/modules/taxonomy/taxonomy.module).

As you can see, it is trying to inject an ISO data rather than a timestamp. I attached a patch that checks if the current node created date is a timestamp and if not, format it properly.

i18n menu links translation in wrong directory

$
0
0

Problem/Motivation

I was excited this morning that the i18n menu links patch was committed but later I was getting this error when working on commerce migrate.
Warning: call_user_func() expects parameter 1 to be a valid callback, class 'Drupal\dynamic_page_cache\EventSubscriber\DynamicPageCacheSubscriber' does not have a method 'onRouteMatch' in Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() (line 111 of core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php).
I tried enabling content_translation and, sure enough, the error went away.

During the long work to get i18n menu links done I often said to myself that the migration needed to move to content_translation, but I always didn't remember when at the keyboard. Sorry!

Just like d6_taxonomy_term_translation.yml d6_menu_links_translation.yml should be in content_translation, which should fix this problem.

There is a second part, in the the source plugin for both should also be in content_translation. The reason for that is because migrate_drupal_ui will use the source_module in the source plugin and then include that source_module in the list, which is should not.

Proposed resolution

At minimum, move d6_menu_links_translation.yml to content_translation

Remaining tasks

Write a patch
commit

Move twig_without() to the TwigExtension where all the other filters are and deprecate

$
0
0

Follow-up to #2568181: [meta] Get ready to upgrade to Twig 2.x

Problem/Motivation

We are currently using some deprecated code that will be removed or not workable in Twig 2.0.

To help move that along we would like to make the TwigExtension more UnitTestable.

Proposed resolution

  • Move twig_without() to the extension

Remaining tasks

User interface changes

n/a

API changes

n/a

Data model changes

n/a

MenuLinkParent breaks migration when Parent URI is external

$
0
0

Problem/Motivation

Migrating from a drupal 6 site and get this error:

[error] The internal path component 'https://example.com/publications.html' is external. You are not allowed to specify an external URL together with internal:/.''

Which is coming from MenuLinkParent because of the assumption that the parent link path is routeable through $url = Url::fromUserInput("/$parent_link_path");

Proposed resolution

Check for external and search for the link uri properties.

Remaining tasks

User interface changes

API changes

Data model changes

Translations of taxonomy vocabulary not show on admin overview

$
0
0

VocabularyListBuilder::buildRobuildRow doesn't use the available translations:

    $row['label'] = $entity->label();

This results in the source language being displayed.

We probably need to check if the entity has a translation first and load that one.

Cannot use relationship for rendered entity on Views

$
0
0

Problem/Motivation

You cannot create a view and try to list rendered entities using relationship.

Steps to reproduce (based on Standard profile):

  1. Add an entity reference field named "field_content" to the "page" content type. Allow content > article references.
  2. Create and edit a content view.
  3. Add a relationship for "Content using field_content." or "Content referenced from field_content."
  4. The row style plugin is "Content" by default.
  5. Click on "Teaser" in order to change the view mode, nothing happens.
  6. You can't choose a view mode even if you don't want to actually use a relationship, just having one on your view triggers this.

The problem is a fatal AJAX error triggered when RowPluginBase::buildOptionsForm() calls RelationshipPluginBase::init() while providing a wrong argument type (Array instead of DisplayPluginBase).

Argument 2 passed to Drupal\views\Plugin\views\relationship\RelationshipPluginBase::init() must be an instance of Drupal\views\Plugin\views\display\DisplayPluginBase, array given, called in /app/web/core/modules/views/src/Plugin/views/row/RowPluginBase.php on line 93

Proposed resolution

Fix it, by passing along the relationship as needed and using it.

Remaining tasks

None.

User interface changes

None

API changes

None

 

Contributor tasks needed
TaskNovice task?Contributor instructionsComplete?
Create a patchInstructionsExtract the test code + yml file out of the patch in #26

Allow formatting of multiple field values as array on REST Export views

$
0
0

In a REST Export display of a view, if one has a multi-valued field, the Multiple Field Settings configuration sub-form provides options for Ordered List, Unordered List, and Simple separator. In my JSON output, I would prefer to be able to select an option for JSON array, so that the elements would be formatted as:

"field_name" : [
"foo",
"bar",
"baz"
]

Add a drupalci.yml to core

Deprecate isLatestRevision, getLatestRevision, getLatestRevisionId in the ModerationInformation service

Missing space between sentences on the Custom Block page

$
0
0

Problem/Motivation

On a fresh install of Drupal, when no custom blocks have been added, the "no results" text on the Custom Block Library page (/admin/structure/block/block-content) reads

There are no custom blocks available.Add a custom block.

There is no space between the two sentences.

Proposed resolution

The Custom Block Library page is created by a view, defined by core/modules/block_content/config/optional/views.view.block_content.yml. That view defines two "no results" items. The first is a text area, and the second uses the views plugin defined at core/modules/block_content/src/Plugin/views/area/ListingEmpty.php. The source of the problem is that these two pieces are pasted together with no space in between.

There are a few possible solutions:

  1. Add a space to the end of the text area.
  2. Add a third "no results" item in between the existing two, with just a space.
  3. Remove the first item and add the text, with a space, to the views plugin.
  4. Add a space at the beginning of the views plugin.

I suppose that neither of the last two options is viable, since it is possible that some sites will have views that use the views plugin.

The first solution is the easiest. Let's start there and see if anyone complains about it.

Do we need an update function? I am willing to skip that, since it will only matter on existing sites that do not have any custom blocks, where someone bothers to look at this page. I am sure there will be some such sites, but not enough that I care about it.

Workarounds

A site owner can edit the view at /admin/structure/views/view/block_content and add a space to the first item under "No results behavior". This should work with or without the patch.

The same thing can be done using the configuration system: see Comment #3.

Remaining tasks

User interface changes

This will change the interface text on /admin/structure/block/block-content.

API changes

None

Data model changes

None

Increase contrast for menu links

Allow configuring of datelist year range date_year_range via UI

$
0
0

When you add a datelist field, the Years available range from 1900 to 2050.

For many uses, that's unnecessarily broad.

It'd be good to be able to configure the range in the manage form display interface.

E.g. to +/- 3 years, or min 2010 and max 2020, etc.

I think Drupal 7 had this feature.

Warn users of what features are not available on a given entity type

$
0
0

Problem/Motivation

Content Moderation adds two options to Workflow states; "Published" and "Default revision". Default revisions are ok for all entity types that use Content Moderation because we currently require revisions, however not all revisionable entity types (even in core) are publishable.

(The publish we are talking about here is related to the 'status' field, not a workflow state called 'Published'.)

See also:
#2830581: Fix ContentModeration workflow type to calculate correct dependencies
#2850627: Do not require a revisionable entity type when using content_moderation.
#2825973: Introduce a EditorialContentEntityBase class for revisionable and publishable entity types
#2812811: Use EntityPublishedInterface during moderation of entities to add support beyond nodes
#2850353: Test content_moderation with a non-bundleable content entity
#2842692: Warn users before enabling moderation on an entity type that can't be (un)published

Proposed resolution

Show a warning in the entity type selection modal in the workflows settings, if an entity type isn't publishable.

Remaining tasks

User interface changes

API changes

Data model changes


Make search button 100% width on small screens

$
0
0

This issue is created from a comment on #2936878: Umami Theme - follow-up - margin/padding left/right for search page elements
Specifically https://www.drupal.org/project/drupal/issues/2936878#comment-12468176

===
I did see this oddity with the search button though on mobile. Ideally, the button would be disconnected from the field on mobile and set at full width. This is because mobile devices need bigger "touch targets" for a variety of accessibility and UX reasons. Attaching a proposed mock-up of how this could look.
===

Current:

Proposed:

Replace hard coded static cache of entities with cache backends

$
0
0

Problem/Motivation

When loading large numbers of entities, especially during migrations and updates, it's quite easy to run out of PHP memory.

Migrate works around this by trying to clear the entity static cache, but this also results in a persistent cache clear.

Static caching is hard coded in storage classes which prevents swapping it out unless you change the whole class.

Proposed resolution

Add a 'static cache' service, which does not serialize at all, but which conforms to CacheBackendInterface.

Rework entity storage to rely on this service instead of a raw class property.

This will allow for two things:

- once this issue has landed, migrate will be able to reset the static cache via the service, therefore not affecting the persistent entity cache.
- in a follow-up, we'll be able to add a simple Least Recently Used implementation, allowing the static cache to have a fixed maximum number of items.
- beyond this, there is the possibility to go even further:
- have a cache backend limited by the actual size of the items in it (will require estimating memory usage of entities)
- add a cache backend, probably in contrib, using PHP weak references http://php.net/manual/en/intro.weakref.php which theoretically will allow cached entities to be removed by garbage collection.

Remaining tasks

User interface changes

API changes

Data model changes

Spinning this out of #1302378: Use multiple specialized entity controllers.

The base EntityController class currently handles keeping it's own 'static' cache internal to the class, or always fetching from the database all the time.

In Drupal 7, this means that http://drupal.org/project/entitycache needs to provide it's own controller class to provide persistent caching for entities.

We can make this a lot more flexible by just replacing the custom caching within the Entity controller class, with a configurable cache controller key instead of the current 'static cache' key. There's no need for entity-specific cache controllers, since any class implementing CacheBackendInterface will do fine.

To allow for 'static' caching, I've added a new ArrayBackend which simply stores cache items in a php array. Apart from expires which didn't seem worth working on until #730060: Replace CACHE_TEMPORARY, cache_clear_all() and minimum cache lifetime with cache tags support is in, this (untested) backend supports everything the database backend does, including tags etc., meaning it should be useful for unit testing eventually.

For no static caching at all, the NullBackend works fine.

To actually implement entitycache in D8 (whether core or contrib), you'd need a backend that proxies the MemoryBackend + whichever one is implemented for the cache_entity bin, since we're placing responsibility for both in a single class doing things this way. There's some inconsistencies with resetCache() etc. that would need to be sorted out for that.

Completely untested patch that will likely blow up, but just to show what it looks like.

One feature gets dropped here, which is fetching from cache when $conditions is passed to entity_load(). That's already a bit wonky as it is, and the $conditions parameter is already on its way out and documented as deprecated in 7.x per #1184272: Remove deprecated $conditions support from entity controller.

Remove @todo in content_moderation related to NULL values of the moderation_state field.

$
0
0

Problem/Motivation

One of the last remaining @todos in content moderation reads:

// @todo what if $entity->moderation_state is null at this point?

This is found in a protected method EntityOperations::updateOrCreateFromEntity which is called only for moderated entities:

  public function entityInsert(EntityInterface $entity) {
    if ($this->moderationInfo->isModeratedEntity($entity)) {
      $this->updateOrCreateFromEntity($entity);
    }
  }

Proposed resolution

The moderation_state field is never NULL for non-moderated entities. Add a test case for this and remove the todo.

Remaining tasks

User interface changes

API changes

Data model changes

Check for missing test coverage in the Content Moderation module

$
0
0

Problem/Motivation

Follow-up to #2725533: Add experimental content_moderation module. The module probably has missing test coverage. There are several @todo's in the code.

Proposed resolution

Identify missing test coverage and resolve the @todo's in sub issues.

Remaining tasks

Workflow

  1. core/modules/workflows/src/Form/WorkflowTransitionEditForm.php:93: // @todo https://www.drupal.org/node/2830584 Add some ajax to ensure that
  2. core/modules/workflows/src/Form/WorkflowTransitionAddForm.php:78: // @todo https://www.drupal.org/node/2830584 Add some ajax to ensure that
  3. core/modules/workflows/src/WorkflowTypeInterface.php:114: * @todo https://www.drupal.org/node/2579743 make part of a generic interface.
  4. core/modules/workflows/tests/modules/workflow_type_test/config/schema/workflow_type_test.schema.yml:27:# @todo, inline this straight into "workflow.type_settings.workflow_type_complex_test"
  5. core/modules/workflows/tests/src/Functional/Rest/WorkflowResourceTestBase.php:104: // @todo Update in https://www.drupal.org/node/2300677.

Content Moderation

  1. core/modules/content_moderation/src/Plugin/Field/FieldWidget/ModerationStateWidget.php:114: // @todo https://www.drupal.org/node/2779933 write a test for this.
  2. core/modules/content_moderation/src/Entity/Handler/ModerationHandler.php:37: // @todo remove this when revision and translation issues have been
  3. core/modules/content_moderation/src/ParamConverter/EntityRevisionConverter.php:32: * @todo: If the parent class is ever cleaned up to use EntityTypeManager
  4. #2973493: Remove @todo in content_moderation related to NULL values of the moderation_state field.
  5. core/modules/content_moderation/src/EntityTypeInfo.php:162: // @todo Core forgot to add a direct way to manipulate route_provider, so
  6. #2973487: Add form #state to force "Default revision" on when "Published" is checked for a new moderation state
  7. core/modules/content_moderation/tests/src/Kernel/ViewsDataIntegrationTest.php:160: // @todo I would have expected that the content_moderation_state default

User interface changes

None

API changes

None

Data model changes

None

Add form #state to force "Default revision" on when "Published" is checked for a new moderation state

$
0
0

Problem/Motivation

Lets resolve a @todo as old as time itself. Equivalent issue in the WBM queue: #2645614: Add form #state to force "make default" on when "published" is on for a state.

Currently you can create a state which is published but not default. Nothing prevents this and the comment "this is implied for published states" isn't actually true. Pending revisions can be created which are published, they are just confusing.

Proposed resolution

Resolve the todo and add validation to ensure published is always accompanied by default.

Remaining tasks

User interface changes

API changes

Data model changes

Viewing all 292905 articles
Browse latest View live


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