Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The values for "Publish updates to Apple News", "Default channels and sections", and "Content visibility" for each node, should really persist. It doesn't make sense to me at least, that you need to reset these each time you save. Currently they derive from the defaults set on the export. The override only works in the node form context, as the overrides are propagated exclusively in $form_state.
Persisting the values would also allow for API based publishing to take the overrides into account, eg. batch publishing or any other programatic form of pushing nodes to Apple News.
Comments
Comment #2
m4oliveiFrom a quick read through of the code, it looks like some of this information has a home already. Each item varies in it's current level of support when it comes to persisting the override value:
Publish updates to Apple News: This is not currently being stored. I think it makes sense to store this in a new column, say
applenews_entities.publish_flag
.Default channels and sections: This is currently being stored in the database per entity, but it isn't being read for setting
#default_value
on the node form. It's stored in bothapplenews_channels.channel_id
,applenews_sections.channel_id
, andapplenews_sections.section_id
Content visibility: This is not currently being stored. This probably makes the most sense to store as part of
applenews_metadata.data
in a key calledisPreview
. Like the other data stored in there, it's returned from the API on Create/Update. You could probably also argue for it being store in it's own column, as we have specific use for it in the UI, similar to channel/section. The bits of metadata that come back in the response that are stored inapplenews_metadata.data
seem to be arbitrary (see http://cgit.drupalcode.org/applenews/tree/applenews.inc?h=7.x-2.x#n685 and http://cgit.drupalcode.org/applenews/tree/applenews.inc?h=7.x-2.x#n792)Comment #3
m4oliveiAlso noticed that the export is not set per-entity either, intended to be stored in
applenews_entities.exid
.Comment #4
m4oliveiWant to note that as I was working on the solution for this, I noticed that you can have multiple rows per entity in
applenews_entities
when you have mutiple channels setup. At first it felt weird to storepublish_flag
andexid
here given that the UI doesn't currently allow that level of granularity. Although conceivably it could, so I'm going to continue with storing these values inapplenews_entities
table.Comment #5
m4oliveiThen again I'd want
publish_flag
,exid
, channels, sections andpreview_flag
to be separate from a saved row inapplenews_entities
, so we can de-couple pushing to Apple News from saving the node form so that a publish to Apple News can be scheduled and run at a later time with the node's overrides being known at that time.At first I toyed with saving incomplete rows to
applenews_entities
, where on node save/update you'd save the Apple News node form settings, and then, as usual when the return comes back from Apple, you save the rest of the data. That doesn't feel right.applenews_entities
should reflect the state of things in Apple News only it's confusing to manage partial rows there.I think it will work out better to have a new table,
applenews_entity_settings
to store all of the settings, and leaveapplenews_entities
and related tables to store data from Apple News.Comment #7
m4olivei