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

Display Bug when using #states (Forms API) with Ajax Request

$
0
0

I use a custom module which makes heavy use of the Forms API to do mathematical calculations.

The form which you can see at http://linsenrechner.de/node/27 is rendered with the #states attribute. each line uses a container to display two fields. When these fields are filled, a new line should appear.
This works perfect, BEFORE the calculation button is pressed and the ajax request is done.
After this, the behaviour of the form changes: When two fields of a specific line are filled not only one new line appears. In this case, all lines, which are defined in the form, appear at the same time.

The author of the custom module, sukr_s (http://drupal.org/user/554988) wasn't able to exactly locate the bug, but believes it's in states.js

Here are the form arrays, which are used to create the form at http://linsenrechner.de/node/27

$form['container0'] = array(
   '#type'   => 'container',
   '#weight'        => -53,
); 

$form['container0']['markup0'] = array(
   '#weight'        => -52,
   '#markup' => "<div id='ocalc_header_33'></div>
                 <div id='ocalc_header_33'>$ocalc_sag_height</div>
                 <div id='ocalc_header_33'>$ocalc_zone</div>",
); 


$form['container0'][$wrapper]['sag0'] = array(
    '#type'          => 'textfield',
    '#title'         => $ocalc_sag_height." 0",
    '#title_display' => 'invisible',
    '#weight'        => -51,
    '#maxlength'     => 4,
    '#size'          => 4,
    '#prefix'  => "<div class='form-item-sag0'>$ocalc_zone 0</div>",
    '#field_suffix'  => "mm",
  );

$form['container0'][$wrapper]['zone0'] = array(
    '#type'          => 'textfield',
    '#title'         => $ocalc_zone." 0",
    '#title_display' => 'invisible',
    '#weight'        => -50,
    '#maxlength'     => 4,
    '#size'          => 4,
    '#field_suffix'  => "mm",
  );

$form['container1'] = array(
   '#type'   => 'container',
   '#weight'        => -43,
   '#states' => array('visible' => array(
		':input[name=sag0]'  => array ('filled' => TRUE),
		':input[name=zone0]' => array ('filled' => TRUE),
    ),
  ),
); 


$form['container1'][$wrapper]['sag1'] = array(
    '#type'          => 'textfield',
    '#title'         => $ocalc_sag_height." 1",
    '#title_display' => 'invisible',
    '#weight'        => -42,
    '#maxlength'     => 4,
    '#size'          => 4,
    '#field_suffix'  => "mm", 
    '#prefix' => "<div class='form-item-sag1'>$ocalc_zone 1</div>",
  );
  
 $form['container1'][$wrapper]['zone1'] = array(
    '#type'          => 'textfield',
    '#title'         => $ocalc_zone." 1",
    '#title_display' => 'invisible',
    '#weight'        => -41,
    '#maxlength'     => 4,
    '#size'          => 4,
    '#field_suffix'  => "mm",                   
  );
 
$form['container2'] = array(
   '#type'   => 'container',
   '#weight'        => -33,
   '#states' => array('visible' => array(
		':input[name=sag0]'  => array ('filled' => TRUE),
		':input[name=zone0]' => array ('filled' => TRUE),
		':input[name=sag1]'  => array ('filled' => TRUE),
		':input[name=zone1]' => array ('filled' => TRUE),
    ),
  ),
); 


$form['container2'][$wrapper]['sag2'] = array(
    '#type'          => 'textfield',
    '#title'         => $ocalc_sag_height." 2",
    '#title_display' => 'invisible',
    '#weight'        => -32,
    '#maxlength'     => 4,
    '#size'          => 4,
    '#field_suffix'  => "mm", 
    '#prefix' => "<div class='form-item-sag1'>$ocalc_zone 2</div>",
  );
  
 $form['container2'][$wrapper]['zone2'] = array(
    '#type'          => 'textfield',
    '#title'         => $ocalc_zone." 2",
    '#title_display' => 'invisible',
    '#weight'        => -31,
    '#maxlength'     => 4,
    '#size'          => 4,
    '#field_suffix'  => "mm",                 
  );

 
$form['container3'] = array(
   '#type'   => 'container',
   '#weight'        => -23,
   '#states' => array('visible' => array(
		':input[name=sag0]'  => array ('filled' => TRUE),
		':input[name=zone0]' => array ('filled' => TRUE),
		':input[name=sag1]'  => array ('filled' => TRUE),
		':input[name=zone1]' => array ('filled' => TRUE),
		':input[name=sag2]'  => array ('filled' => TRUE),
		':input[name=zone2]' => array ('filled' => TRUE),
    ),
  ),
); 


$form['container3'][$wrapper]['sag3'] = array(
    '#type'          => 'textfield',
    '#title'         => $ocalc_sag_height." 3",
    '#title_display' => 'invisible',
    '#weight'        => -22,
    '#maxlength'     => 4,
    '#size'          => 4,
    '#field_suffix'  => "mm", 
    '#prefix' => "<div class='form-item-sag1'>$ocalc_zone 3</div>",
  );
  
 $form['container3'][$wrapper]['zone3'] = array(
    '#type'          => 'textfield',
    '#title'         => $ocalc_zone." 3",
    '#title_display' => 'invisible',
    '#weight'        => -21,
    '#maxlength'     => 4,
    '#size'          => 4,
    '#field_suffix'  => "mm",                 
  );

$form['container4'] = array(
   '#type'   => 'container',
   '#weight'        => -13,
   '#states' => array('visible' => array(
		':input[name=sag0]'  => array ('filled' => TRUE),
		':input[name=zone0]' => array ('filled' => TRUE),
		':input[name=sag1]'  => array ('filled' => TRUE),
		':input[name=zone1]' => array ('filled' => TRUE),
		':input[name=sag2]'  => array ('filled' => TRUE),
		':input[name=zone2]' => array ('filled' => TRUE),
		':input[name=sag3]'  => array ('filled' => TRUE),
		':input[name=zone3]' => array ('filled' => TRUE),
    ),
  ),
); 


$form['container4'][$wrapper]['sag4'] = array(
    '#type'          => 'textfield',
    '#title'         => $ocalc_sag_height." 4",
    '#title_display' => 'invisible',
    '#weight'        => -12,
    '#maxlength'     => 4,
    '#size'          => 4,
    '#field_suffix'  => "mm", 
    '#prefix' => "<div class='form-item-sag1'>$ocalc_zone 4</div>",
  );
  
 $form['container4'][$wrapper]['zone4'] = array(
    '#type'          => 'textfield',
    '#title'         => $ocalc_zone." 4",
    '#title_display' => 'invisible',
    '#weight'        => -11,
    '#maxlength'     => 4,
    '#size'          => 4,
    '#field_suffix'  => "mm",                   
  );

Notice: Undefined index: #type in drupal_process_states()

$
0
0

Problem/Motivation

Problem

  • When #states is attached to a form element that contains #markup the following notice occurs:

    Notice: Undefined index: #type in drupal_process_states() (line 583 of core/includes/common.inc).

Cause

  • This happens because a #markup element does not require the #type to be set.

Proposed resolution

  1. Fix the PHP notice.
  2. Add a regression (kernel) test to ensure that this bug does not reappear in the future.

Notes

  • There are no PHP/backend tests for #states right now, because the "functionality" on the PHP side is in essence just a json_encode(), so nothing worth to test.

Remaining tasks

  • Make sure patch applies to 8.5.x and 8.6.x as well.
  • Write an unit (kernel) test to ensure that the bug does not reappear in the future.

User interface changes

No.

API changes

No.

Data model changes

No

ManyToOneHelper ignores group configuration for some cases and forces INNER joins

$
0
0

Bug description

We've met a buggy behaviour of a view having two reference-field filters in an OR subgroup.

That's how filters looked like:

And this is the resulting query:

There are two issues:
1. AND operator is used instead of OR one.
2. Even if OR operator would be used, INNER join breaks the OR logic.

STR

1. Create new Drupal 8 installation with a Standard profile.
2. Export configuration.
3. Copy/replace files from attached configuration-parts.tgz.
4. Import/synchronize the configuration.
5. At admin/structure/views/settings enable the "Show the SQL query" option.
6. Visit admin/structure/views/view/many_to_one_test and see the resulting query.

Remaining tasks

- decide if we want to somehow determine when the INNER join can be used

File Field design update: Upload field.

$
0
0

Problem/Motivation

In terms of interaction, file fields could be a lot more accessible. The style guide proposes both a new appearance and a new interaction design.

Proposed resolution

  1. Files can be added from the local filesystem using drag-and-drop, or using the traditional click-browse-attach workflow (which hands the action off to the OS and back)
  2. Files upload automatically once added by dropping or browsing.
  3. Uploaded files provide a preview where possible (images) or a file-type-specific icon where not.
  4. File fields with multiple attachments use progressive disclosure to reveal each additional slot in turn. They should support dropping multiple files onto a single dropzone to upload multiple files at once.
  5. The “Browse Library” functionality is speculative at this time, but designed to accommodate contrib.
  6. Some aspects of the design are postponed to follow ups (improving multiple file fields, the progress bar, mobile improvements). See the complete list below.

An important reason to encapsulate much of this functionality, is that it tends to scale much better amongst many items and especially if placed between forms it can serve as a clear visual landmark.

Aspects of proposed design postponed to follow-ups

11.file-field.png

Test Pages

  • A file field will have to be created and add to an existing content type

Screenshots (patch #191)

Empty file/image fields
Empty file/image fields

Filled file/image fields
Filled file/image fields

PDOException: SQLSTATE[22018]: Conversion failed when converting the varchar value 'configure' to data type int

$
0
0

Follow up to PostgreSQL: PDOException:Invalid text representation when attempting to load an entity with a string or non-scalar ID.

In comment #256 @soyarma was right, the revision id needs to be cleaned as well. I came across this issue with the webform module. The error in watchdog was:

PDOException: SQLSTATE[22018]: [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Conversion failed when converting the varchar value 'configure' to data type int.: SELECT revision.[vid] AS [vid], base.[uid] AS [uid], revision.[title] AS [title], revision.[log] AS [log], revision.[status] AS [status], revision.[comment] AS [comment], revision.[promote] AS [promote], revision.[sticky] AS [sticky], revision.[vuuid] AS [vuuid], revision.[ds_switch] AS [ds_switch], base.[nid] AS [nid], base.[type] AS [type], base.[language] AS [language], base.[created] AS [created], base.[changed] AS [changed], base.[tnid] AS [tnid], base.[translate] AS [translate], base.[uuid] AS [uuid], revision.[timestamp] AS [revision_timestamp], revision.[uid] AS [revision_uid] FROM node base INNER JOIN node_revision revision ON revision.nid = base.nid AND revision.vid = :revisionId WHERE ( ([base].[nid] IN (:db_condition_placeholder_0)) ); Array ( [:db_condition_placeholder_0] => 86475 [:revisionId] => configure ) in DrupalDefaultEntityController->load() (line 198 of E:\KDN\includes\entity.inc).

Unfortunately the patch at #16 is not resolving it.

\Drupal\Tests\system\Functional\Cache\AssertPageCacheContextsAndTagsTrait::assertCacheContexts() is unhelpful after conversion to phpunit

$
0
0

Problem/Motivation

Making this a bug in the test helper trait as it is pretty useless like this now as phpunit fails on the first message:

this part:

    if (!$match) {
      debug('Unwanted cache contexts in response: ' . implode(',', array_diff($actual_contexts, $expected_contexts)));
      debug('Missing cache contexts in response: ' . implode(',', array_diff($expected_contexts, $actual_contexts)));
    }

    $this->assertIdentical($actual_contexts, $expected_contexts, $message);

The problem is that phpunit fails on the first error, which includes debug messages, and especially if the problem is *missing* cache contexts, then you only see the first useless message.

Proposed resolution

Just drop that debug stuff, phpunit shows a nice diff in case of assertIdentical() mismatches.

While we're at it, we should however also revert expected/actual so that the diff order makes sense.

Remaining tasks

User interface changes

API changes

Data model changes

php 7.1 Warning: A non-numeric value encountered in theme_pager()

$
0
0

PHP 7.1 and Drupal commerce, navigating to /admin/commerce/orders to view orders generates the following warning:

Warning: A non-numeric value encountered in theme_pager() (line 329 of /includes/pager.inc).

This is directly the result of the new warnings in php 7.1 performing arithmetic operations on variables that are empty or not integer. While I found this in Drupal commerce, the file generating the warning is in core so I suspect the same would occur outside diurnal commerce.

The code causing the problem is:

$pager_middle = ceil($quantity / 2);

and will generate the warning if $quantity is empty. To fix the problem, I replace the line where $quantity is set :

$quantity = $variables['quantity'];

with

$quantity = empty($variables['quantity']) ? 0 : $variables['quantity'];

I have attached the patch. This is the first time I submit a patch for core, apologies if I'm not following the correct protocol.

The SQL storage cannot change the schema for an existing entity type (node) with data

$
0
0

Hi all,

When updating from 8.4.5 to 8.5.1 I have this error (on 4 different sites):

system-module
#8501 bijwerken
Mislukt: Drupal\Core\Entity\EntityStorageException: The SQL storage cannot change the schema for an existing entity type (node) with data. in Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema->onEntityTypeUpdate() (regel 347 van /home/oms/domains/domain.nl/public_html/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorageSchema.php).

What can I do to fix this?

Thanks,
Rolf


Provide bulk action to delete all old revisions of a node

$
0
0

Problem/Motivation

With a reasonable site, the number of revisions for an entity can build up quite easily.

Proposed resolution

Provide a bulk action for admins to clear out extraneous revisions.

Remaining tasks

Code and UX reviews

User interface changes

New action

API changes

Data model changes

Release notes snippet

A new action is available on the admin/content view allowing content-admins to remove old revisions in bulk.

Original report

An action to delete all old revisions of a node in Drupal 8 would be very helpful on the administer content overview for example. Furthermore log entires should document that deletion.

getMessageIterator() no longer retrieves source IDs

$
0
0

Problem/Motivation

getMessageIterator() formerly retrieved the source IDs for each message - however, as a result of #2613878: Use hash for Migration source keys, rather than verbatim values the message table no longer contains those IDs in favor of a hash.

Proposed resolution

Pull the source IDs from the map table and return those instead of the hash.

Remaining tasks

Write tests.

User interface changes

N/A

API changes

None

Data model changes

None

Original issue summary (from migrate_tools queue)

drush mmsg displays the columns of the messages table - however, we're now using a hash of the source IDs as a key, which is not very useful. We should pick up the real source IDs from the map table and display those instead.

Views Rendered Entity field ignores the configured rendering language of the view display.

$
0
0

Problem/Motivation

When views are configured to display fields, and 'Rendered entity' is added as one of the fields, if an entity has any translations, for each view row that display that entity or its translation, the rendered entity displayed will ignore the 'Rendering language' configuration of the view display. A good example of such a view is the media_library view in the media_library module.

Steps to reproduce:

  1. On a multilingual site, configure a content type to be translatable.
  2. Create a node of that type.
  3. Add a translation of that node, and change the field values of the translation so differences are obvious.
  4. Create a content view.
  5. Configure the view to show fields.
  6. Add "Rendered entity" field
  7. Set the "Rendering Language" of the display to "Content language of view row".
  8. Preview the results, and observe that the node appears twice in the same language.

Proposed resolution

The view method of \Drupal\views\Plugin\views\field\RenderedEntity does not pass in a langcode to $view_builder->view(), so the entity is rendered per the site content language negotiation configuration.

Getting the langcode from the entity translation renderer and passing it into $view_builder->view() should provide the correct rendering language.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Session Changes in symfony 3.4.24 break session saving

$
0
0

Problem/Motivation

Still figuring this out, but #3044155: PHP7.1 vendor max Testing issue - DO NOT COMMIT identified test failures with symfony 3.4.24, released today, 2019-04-02.
https://www.drupal.org/pift-ci-job/1249248 shows the failing tests.

I've tracked it down to session handling, and specifically this commit: https://github.com/symfony/symfony/commit/029fb2e7e36b7cdf29e27d4bfa54dd...
seems our session isn't showing as started, so it isn't getting saved.

Proposed resolution

Discussed with mikelutz and mglaman in slack, we might need to override the SessionManager->isStarted() to be aware of our lazy session handling.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Fixed session handling with Symfony 3.4.24

[JS] Replace jQuery.cookie with JS-cookie and provide a BC layer

[PP-1] Node module revision permission IDs are too generic

$
0
0

Problem/Motivation

Node module defines
- delete all revisions
- view all revisions
But neither of these reference 'node'

Proposed resolution

Make these more specific.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

\Drupal\Tests\node\Functional\Update\NodeUpdateTest is expensive - refactor

$
0
0

Problem/Motivation

\Drupal\Tests\node\Functional\Update\NodeUpdateTest does an update from rc1 for each testSomethingMethod which is expensive

Proposed resolution

Refactor into a series of doTestBeforeX and doTestAfterX methods so we only update once.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet


UnmetDependenciesException when installing Drupal 8

$
0
0

Some unknown system requirement or setting not specified in the requirements is rendering Drupal uninstallable.

Manifests as: Cannot install Drupal, hangs at "Installing Drupal: Initializing"
Initializing
I let it hang all night, tried 5 or 6 times. It managed to created some database entries (screenshot). The only install warning I got was no opcache (due to a recent update config problem), otherwise, I generally run bloated PHP scripts and massive D6/D7 sites on my local all the time and have no problems.

I have marked this as "critical" because, well, it blocks installation. Using minimal install, mariadb.

Here's the output of the error page when I eventually interrupt the process:

Error
The website encountered an unexpected error. Please try again later.
Drupal\Core\Config\UnmetDependenciesException: Configuration objects (block.block.stark_admin, block.block.stark_branding, block.block.stark_local_actions, block.block.stark_local_tasks, block.block.stark_login, block.block.stark_messages, block.block.stark_page_title, block.block.stark_tools) provided by minimal have unmet dependencies in Drupal\Core\Config\UnmetDependenciesException::create() (line 89 of core/lib/Drupal/Core/Config/UnmetDependenciesException.php).

Drupal\Core\Config\UnmetDependenciesException::create('minimal', Array)
Drupal\Core\Config\ConfigInstaller->checkConfigurationToInstall('module', 'minimal')
Drupal\Core\ProxyClass\Config\ConfigInstaller->checkConfigurationToInstall('module', 'minimal')
Drupal\Core\Extension\ModuleInstaller->install(Array, )
Drupal\Core\ProxyClass\Extension\ModuleInstaller->install(Array, )
install_install_profile(Array)
install_run_task(Array, Array)
install_run_tasks(Array)
install_drupal(Object)

Here is my phpinfo(). I'm happy to give any other output, I use a debugger and can give useful debug information.

Drupal 8 installation fails with "Configuration objects ... provided by standard have unmet dependencies"

$
0
0

An AJAX HTTP request terminated abnormally.
Debugging information follows.
Path: /drupal-8.0.0/core/install.php?rewrite=ok&langcode=en&profile=standard&id=1&op=do_nojs&op=do
StatusText: error
ResponseText:
ReadyState: 0

The website encountered an unexpected error while installing Drupal 8.2.7.

$
0
0

I am getting the following error while installing drupal 8.2.7.

I am using PHP Version 7.0.15-0 and ubuntu0.16.04.4.

Error
The website encountered an unexpected error. Please try again later.
Drupal\Core\Config\UnmetDependenciesException: Configuration objects (block.block.bartik_help, block.block.bartik_search, block.block.seven_help, contact.form.feedback, core.entity_form_display.node.article.default, core.entity_form_display.node.page.default, core.entity_form_display.user.user.default, core.entity_view_display.node.article.default, core.entity_view_display.node.article.teaser, core.entity_view_display.user.user.compact, core.entity_view_display.user.user.default, field.field.node.article.field_image, field.field.user.user.user_picture, field.storage.node.field_image, field.storage.node.field_tags, field.storage.user.user_picture, rdf.mapping.comment.comment, rdf.mapping.node.article, rdf.mapping.node.page, rdf.mapping.taxonomy_term.tags, taxonomy.vocabulary.tags) provided by standard have unmet dependencies in Drupal\Core\Config\UnmetDependenciesException::create() (line 84 of core/lib/Drupal/Core/Config/UnmetDependenciesException.php).
Drupal\Core\Config\UnmetDependenciesException::create('standard', Array) (Line: 460)
Drupal\Core\Config\ConfigInstaller->checkConfigurationToInstall('module', 'standard') (Line: 132)
Drupal\Core\ProxyClass\Config\ConfigInstaller->checkConfigurationToInstall('module', 'standard') (Line: 141)
Drupal\Core\Extension\ModuleInstaller->install(Array, ) (Line: 83)
Drupal\Core\ProxyClass\Extension\ModuleInstaller->install(Array, ) (Line: 1571)
install_install_profile(Array) (Line: 661)
install_run_task(Array, Array) (Line: 539)
install_run_tasks(Array) (Line: 116)
install_drupal(Object) (Line: 44)

Thanks

Search for node content in current language

$
0
0

Problem/Motivation

When searching for content in a multilingual website, Drupal core display results in all languages.

Proposed resolution

When no language is chosen in advance-search, display results only in current language.

Remaining tasks

Create a patch.

EntityViewBuilder::getBuildDefaults doesn't respect the EntityInterface of the $entity parameter

$
0
0

Problem/Motivation

The EntityViewBuilder::getBuildDefaults has an $entity parameter that should respect the EntityInterface.

Yet in the getBuildDefaults() method there's a call on the $entity object to a method that's not on the EntityInterface:

$entity->isDefaultRevision();

isDefaultRevision() lives on the ContentEntityBase but EntityViewBuilder might be used by a ConfigEntityBase.

This may result in an error Error: Call to undefined method Drupal\my_module\Entity\MyConfigEntity::isDefaultRevision() in EntityViewBuilder.php on line 181

Proposed resolution

We should check if the entity is an instance of RevisionableInterface first:

$entity instanceof RevisionableInterface
Viewing all 291783 articles
Browse latest View live


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