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.
Hi
First of all: Thanks for this great module!
I installed it on two of my websites and shariff buttons in blocks work fine.
When I add the field with shariff buttons to node types or taxonomies, then the buttons are not shown. They are only shown when I edit each single node/taxonomy and save it.
I am using display suite, so I can't say whether this does not happen without display suite.
However, any other field I am adding is, as it should, always shown.
Comment | File | Size | Author |
---|---|---|---|
#11 | DisplayButtonsByDefault-2475739-11.patch | 3.24 KB | criz |
Comments
Comment #1
crizHi beauregard,
This is a matter of setting the default. Without saving the entity including the field (thus having no value), what should be displayed?
Currently no buttons are displayed, but it can be also the other way around.
Probably we should change this (so that buttons are displayed by default) or we include a setting for this.
Comment #2
beauregard CreditAttribution: beauregard commentedhm, I don't understand exactly what you mean, or maybe I did not write it clearly. I make an example:
I have a site with 1000 nodes and 150 taxonomies.
Now I install Shariff and I want that the shariff buttons are shown for the 1000 nodes and 150 taxonomies. So, in order to make it work, I have to open&edit&save 1000 nodes and 150 taxonomies.
This does not make sense. What is the logic to edit each node again? It has nothing to do with the content, I simply want the shariff buttons there to share content....
Comment #3
crizYes, I think I understood your issue. And as I said we should probably change the default behaviour.
The idea behind having a field for the buttons is that the editor can disable/enable buttons per entity/node. For just placing the buttons the block or the panels pane would be the better solution.
Comment #4
beauregard CreditAttribution: beauregard commentedah, now I understand it. Well, the luxury solution would be that this can be configured:
Option A: Show buttons on all nodes of this node type
Option B: Allow editor to switch it on/off including definition of a default value by the admin
Comment #5
crizAfter thinking about this a little bit I would propose the following:
- Add a setting in the field formatter form where you can choose if the buttons should be displayed by default. I am not a big fan of adding more settings and complexity but this way we have backwards compatibility.
- For hiding the field to the editor I would be also possible to go with a permission, this way editing the field can be disabled or just activated for a special role. But I consider this as an extra feature request that requires still more thinking I guess. Not sure this is really needed, there is also the field_permissions module btw.
Comment #6
beauregard CreditAttribution: beauregard commentedHi
The first option would be great, because it really helps integrating shariff buttons in existing sites.
The second option is in my opinion something different than you spoke in #3 about. You said there that the button can be enabled/disabled per node. But #5 is per node type. Maybe you meant also in #3 node type?
If it is about node type, I would not include this option, because as you write there is the field_permission module.
Comment #7
beauregard CreditAttribution: beauregard commentedHi
Do you definetely plan to introduce this option to show the buttons by default, and if yes, by when? I am asking because depending on it I will take an alternative way or not.
thanks
Comment #8
crizAdding a setting for displaying the buttons by default is definitely on my todo-list and would be the next task.
Comment #9
crizComment #10
beauregard CreditAttribution: beauregard commentedthat's great, thanks for the fast reply
Comment #11
crizHere is a patch. Needs some feedback if it makes sense this way and the wording is accurate.
Comment #12
beauregard CreditAttribution: beauregard commentedThanks for the patch.
I tested it on a site with existing nodes (taxonomies) and it worked well.
About the wording:
- The explaining text "Check this when..." is understandable and clear for me.
- The label "Display buttons even when field is empty?" is probably somehwat confusing for the user, he might ask himself "what can be empty, these are buttons"? Maybe we should change to something like "Display buttons by default (also for existing entities)."
English is not my native language, so probably somebody else should also give feedback.
Comment #13
discipolo CreditAttribution: discipolo commentedi think it would make more sense to show the buttons by default on all entities that have this field (without having to check another setting) since this is the most obvious reason of adding the field.
so if there is an additional option on field creation it should be "Hide buttons by default (also for existing entities)"
in that case here is the helptext i suggest to go along with the option:
Check this if you want to hide the share buttons on entities created previous to installing/enabling Shariff. If unchecked the share buttons will appear on all previously existing entities.
Since we have a defaultvalue checkbox to show/hide on a per entity basis it could also be a checkbox "apply default to all existing entities" which would allow changing the value on all existing entites back and forth flexibly (with notice that this will change even values which are overridden on entities).
Comment #14
crizthx for having a look on this.
Not sure about this because of backwards compatibility (this is also the main reason I created this setting): Introducing this behaviour would suddenly add buttons to nodes where they haven't been shown so far. If we change the default to show it everywhere we need to at least add this bold in the release notes.
The button field's primary value is that editor can toggle the display. Then we would also need to hide the field in the node edit form. I think this is another issue.
Comment #15
discipolo CreditAttribution: discipolo commentedrelease notes change notice sounds fine (and maybe even a postupgrade message?)
it does seem more sensible to me that the default (as in the setting that doesnt require me to check a checkbox) should be to show buttons. hiding buttons should happen optionally per entity. (as opposed to the other way around)
on second thought i believe we don`t even need to provide a way to apply the default setting (be it view or hide) to all existing entities since vbo can do that and so can rules.
not sure why you want to hide the field on the edit form but that is a different issue to be discussed there.
the patch looks good and worked as advertised during initial tests btw.
Comment #17
crizThanks discopolo. Adopted the naming and help description and comitted this patch.
Not sure this is really needed though, for Drupal8 I would prefer to get rid of this setting and display buttons always by default.
Comment #18
criz