Problem/Motivation
After working with DANSE for a few weeks on a development site, I've tinkered with some things, mostly to improve (at least in my opinion) the user interface, especially the wording, and am offering them for consideration here.
Steps to reproduce
Install and enable module, configure for subscriptions on at least one content type, move subscription widget into node display for that content type.
Proposed resolution
1. The first group of changes concerns the notification widget on individual nodes.
- A. The widget currently uses the node title in its sub/unsub links. Sometimes the node title can be pretty long, to the point that it runs off the page, especially on mobile. I've changed the link to replace "(node title)" with "this (content type)" in modules/content/src/Topic/TopicBase.php:
- return (string) $this->t('Subscribe to @title when it gets @action', $args);
+ return (string) $this->t('Subscribe to this @bundle when it gets @action', $args);
So instead of saying "Subscribe to Really Long Article Node Title That Runs Off The Page Especially On Mobile when it gets updated," it will say "Subscribe to this article when it gets updated."
- B. Related, also in TopicBase.php, I changed the content type subscription links, adding the work "all," to clarify that the link will sub/unsub the user to all content of that type:
- return (string) $this->t('Subscribe to @bundle content when it gets @action', $args);
+ return (string) $this->t('Subscribe to all @bundle content when it gets @action', $args);
- return (string) $this->t('Unsubscribe from @bundle content when it gets @action', $args);
+ return (string) $this->t('Unsubscribe from all @bundle content when it gets @action', $args);
I considered completely removing the content type sub/unsub links from the individual nodes, so that the user would have to go to the subscription tab on the user profile in order to manage content type subscriptions. I still might do that. On the one hand, I worry that users will get confused despite the addition of "all" and accidentally sub/unsub themselves from the content type when they want only to sub/unsub for the individual node. On the other hand, though, I hate to make users hunt around any more than necessary for the content type links.
- C. At first, I couldn't find the unsubscribe link for a node that I'd subscribed to. That's because the link is way down at the bottom of the dropdown. My thinking is that the unsubscribe link(s) should be more prominent. This change in modules/content/src/Service.php simply reverses the order of the links:
if (!empty($operations)) {
+ $operations = array_reverse($operations);
2. The second group of changes involves the subscriptions tab on the user profile page.
- A. The labels in the "settings" section do not match the labels in the DANSE notification widget on the node pages, and the wording could be clearer. I've made this change in modules/content/src/Plugin/Danse/Content.php:
- $this->t('@topic @entity_type of type @bundle', [
+ $this->t('Subscribe to @bundle @entity_type (@topic)', [
- B. The "settings" title is not very informative, especially because the section is closed by default. I've changed both in src/Service.php:
- '#title' => $this->t('Settings'),
- '#open' => FALSE,
+ '#title' => $this->t('Content type subscriptions'),
+ '#open' => TRUE,
("Content type subscriptions" may not be quite right because of the possibility of subscriptions to things other than content. Ideas? Also, this might be better as a config setting, since some people might like it as is.)
3. The final set applies only to the administration area, specifically the DANSE tab on e.g. admin/structure/types/manage/(content type). I just want to improve the help for the "default value" checkboxes. The current working slowed me down a little during setup. The change is on modules/content/src/Plugin/Danse/ContentSettingsTrait.php:
- 'push' => $this->t('Default value for push'),
- 'force' => $this->t('Default value for force'),
- 'silent' => $this->t('Default value for silent'),
+ 'push' => $this->t('Default value for "Create push notification"'),
+ 'force' => $this->t('Default value for "Force push even if this creates duplicate notification"'),
+ 'silent' => $this->t('Default value for "Make this silent and do not create any notifications"'),
Remaining tasks
Merge request to come.
User interface changes
Change wording in various places. Reverse sort of links in notification widget. Make list default to open on user profile subscriptions tab.
API changes
None
Data model changes
None