Hello all,
I have a very strange case when upgrading to drupal 8.4.0.
On content types created in Drupal 8, I see the new published checkbox and label above the Save button.
However, On node content types that were migrated from drupal 6 to drupal 8, the published checkbox is there, but its missing the label.
This is really strange because on the /admin/structure/types/manage/<contenttype>/form-display page, this published field is there, but missing the label (see screenshot drupal6_content_type_form_display.jpg)
The checkbox works when saving the node as in a published or unpublished state. But its annoying to the user to have a floating checkbox above the Save button.
However, if I go to the /admin/content page and filter by the same Content type of <contenttype>, I can see the Published / Unpublished text.
I looked into the EntityPublishedTrait.php class, specifically the function publishedBaseFieldDefinitions()
public static function publishedBaseFieldDefinitions(EntityTypeInterface $entity_type) {
I tried updating it with ->setLabel(t('Published by Me')) which changed the content types created in drupal 8, but the ones created in drupal 6 and migrated to drupal 8 were still blank!
Has anyone else come across missing published labels on content types?
| Comment | File | Size | Author |
|---|---|---|---|
| drupalchanges.jpg | 56.06 KB | sagesolutions | |
| drupal8_content_type_form_display.jpg | 74.23 KB | sagesolutions | |
| drupal6_content_type_form_display.jpg | 34.5 KB | sagesolutions |
Comments
Comment #2
sagesolutions commentedComment #3
xjmComment #4
beccaneer commentedThis was an internal issue related to old .yml files from migration from D6 to D8. We have fixed it on our end.
Comment #5
xem8vfdh commentedThanks! @beccaneer, my content types show empty/blank labels for this published checkbox, similar to what's shown in the screen shots above. It looks like I can't manually add a "Published" label in the "Manage Form Display" page... so? What .yml file/lines did you change to fix this?
EDIT:
@beccaneer: it looks like, as a result of my D6 to D8 migration, I had various entried like the following (see below) for my content types created in D6:
and corresponding config files:
I deleted the config files, which showed differences queued for synchronization in
Configuration >> Development >> Configuration Synchronization. I then ran the synchronize option on that page, and it removed the entries from my database. As a result, I now see the proper "Published" label on "Manage form display" pages and on the create/edit content type pages. So, I think this solves the problem, but am hesitant to push changes to production. Is this what you did @beccaneer, or does anyone else know if this is a safe approach?Comment #6
sagesolutions commented@xem8vfdh
Yes, that is how @becanneer fixed it.
We removed a lot of
config/sync/core.base_field_override.node.<content-type>.status.ymlfiles, randrush config-importand the published label was back!I would say its safe to push it to production.
Comment #7
xem8vfdh commentedthanks @sagesolutions (and @becanneer)!
Comment #8
aarnold101 commentedSame issue. "Published" label did not appear next to checkbox after upgrading D8.3 to D8.4
Same history. Went from D6-->D8 directly. But we used custom-built migration scripts.
Different solution. Because we had no
config/sync/core.base_field_override.node.<content-type>.status.ymlfiles there was nothing to delete in order to fix this issue as per solutions above. So I did a direct database fix using the below MYSQL statementupdate config set data = replace(data, ';N;', ';s:9:"Published";') where name like 'core.base_field_override.node.%.status';Then clear drupal cache and problem solved.
CAUTION: I cannot confirm that the exact above statement will work to solve this issue in every instance. It may not even be a permanent solution pending future updates. The ";s:9" portion may be unique from site to site. I am not well versed enough in the D8 architecture to be sure. Examine the data field of your config table
where name like 'core.base_field_override.node.%.status'to make a more informed decision.Comment #9
cestmoi commentedI had the exact same issue on a locally installed D8.5.3 that I updated from D8.1.7 which I'd upgraded from D6 after much headache and several failed attempts using the Upgrade using web browser way.
In my case there was no
config/sync .ymlfiles and so couldn't try the fix mentioned by @becanneer .I happened to have another local fresh D 8.5.3. install that I then upgraded from D6. This one had no such issue with imported nodes. I searched the config table of this one for
'core.base_field_override.node.%.status'and found nothing in this one compared to the config table in the one with the issue. This one had 5 such rows, one for each content type I have. I deleted those rows and then cleared thecache_tables and all fixed. The "Published" label now appear on editing migrated nodes and in the Manage Form Display page.I'm not sure if what I did was fine and safe but so far all is looking good!
Comment #10
dalinIf the problem is the config written to your config directory, then you can: