0

I have a new Drupal 8 site (single, non-English language, I have a hunch this plays some part in the problem). After installation, I changed the description of the two prefabricated content types (Article and Page), as well as the name of the Tags vocabulary. The changed descriptions don't appear on the /node/add page, I still have the old descriptions. More than that, looking into the stored entity data reveals strange differences, too. When I dump the node type list in the node.module like this:

function template_preprocess_node_add_list(&$variables) {
  dpm($variables['content']);

This shows the following:

Array
(
    [article] => stdClass Object
        (
            [__CLASS__] => Drupal\node\Entity\NodeType
            [type] => article
            [name] => Article
            [description] => `Original description`
            [help] =>
            [new_revision] => 
            [preview_mode] => 1
            [display_submitted] => 1
            [originalId] => article
            [status] => 1
            [uuid] => c86c5b86-8a8a-4ec8-a56f-f315ee6ce23f

However, when I use the Devel tab to examine the node type in the content type editor, it shows:

stdClass Object
(
    [__CLASS__] => Drupal\node\Entity\NodeType
    [type] => article
    [name] => Article
    [description] => `New description`
    [help] =>
    [new_revision] => 
    [preview_mode] => 1
    [display_submitted] => 1
    [originalId] => article
    [status] => 1
    [uuid] => c86c5b86-8a8a-4ec8-a56f-f315ee6ce23f

They both clearly are supposed to read the same entity from the database, all other data are identical (yes, langcode is the same as well), just not the description.

All cache clearing and rebuilding has already been done, for sure.

Update: it will be the language all right. If I peek into the config table, most config entries (including these) are duplicated. Once without collection, and again with the language specified. I don't think this is correct like this but how can I avoid it or correct it (except for deleting manually from the database)?

Update 2: Not yet an answer although I solved the problem, this seems a Drupal bug to me. The content type description was a red herring, it can happen with any config item. What I did was:

  1. Drupal was installed in English (I happened to start with a preinstalled image but this can happen in any other scenario quite easily).

  2. Another language, XX was added to the site.

  3. Some items were changed in the site, it isn't important what they were, content type, fields, taxonomy, anything that's stored in the config table these days.

  4. English was removed, leaving only language XX.

Step 3 introduces duplicate entries in config where the language is referenced in the collection field. I suppose that if I remove language XX, those will be gone, too. But in Step 4, I removed English, not language XX. Consequently, I was left with duplicate config items, both empty and language=XX in collection.

Yes, it's perfectly clear that without these two extra steps, there wouldn't have been extra items in config. Still, I don't think this is solid enough if it's reproducible like I describe.

  • Export the config drush cex and then after changing the description in UI, export again to see the difference, although if you have installed Drupal in a single language you shouldn't have multiple translations of the config objects. – 4k4 May 20 '18 at 16:24
  • Actually, after making a backup, I simply decided to delete all items where there was a language variant of any config object and it works now. But isn't this a bug in Drupal? I wouldn't expect adding and removing a language to cause such problems (at least, removing a language should remove all related config items). I never had anything similar in earlier Drupals, although the config system is very much different now, that's for sure. – Gábor May 20 '18 at 17:26
  • To put it into perspective, I was unable to change the items in Devel Config Editor, either. And that's really strange. It supposedly saved the modified entry, I got a message to that effect, and nothing was actually changed in the database, reading the same entry again re-loaded the unmodified, original contents of the config entry. – Gábor May 20 '18 at 17:28
  • Yes, you're right with the installation but this time, it's not yet on a server. I decided to give Bitnami a try to set up a sytem locally because I have an awful lot of own module code porting to do before I will have anything that resembles a functioning site again. :-) And their Drupal stack comes preinstalled in English. But it's a bog standard empty Drupal, so I don't want to blame them for this mishap. – Gábor May 20 '18 at 17:31
  • You change the description in the BackOffice ? Do you use a distribution or just the Drupal 8.5 version ? – JudaPriest May 21 '18 at 13:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.