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?

Comments

sagesolutions created an issue. See original summary.

sagesolutions’s picture

Issue summary: View changes
xjm’s picture

Issue tags: -node +8.4.0 update
beccaneer’s picture

Status: Active » Closed (won't fix)

This was an internal issue related to old .yml files from migration from D6 to D8. We have fixed it on our end.

xem8vfdh’s picture

Thanks! @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:

core.base_field_override.node.<CONTENT-TYPE>.promote
core.base_field_override.node.<CONTENT-TYPE>.status
core.base_field_override.node.<CONTENT-TYPE>.sticky

and corresponding config files:

sites/default/config/core.base_field_override.node.<CONTENT-TYPE>.promote.yml
sites/default/config/core.base_field_override.node.<CONTENT-TYPE>.status.yml
sites/default/config/core.base_field_override.node.<CONTENT-TYPE>.sticky.ym

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?

sagesolutions’s picture

@xem8vfdh

Yes, that is how @becanneer fixed it.

We removed a lot of config/sync/core.base_field_override.node.<content-type>.status.yml files, ran drush config-import and the published label was back!

I would say its safe to push it to production.

xem8vfdh’s picture

thanks @sagesolutions (and @becanneer)!

aarnold101’s picture

Same 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.yml files 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 statement

update 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.

cestmoi’s picture

I 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 .yml files 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 the cache_ 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!

dalin’s picture

If the problem is the config written to your config directory, then you can:

cd directory/where/your/config/is/stored
perl -pi -w -e "s/label\: null/label\: 'Published'/g" core.base_field_override.node.*.status.yml
drush cim -y