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.

CommentFileSizeAuthor
#11 DisplayButtonsByDefault-2475739-11.patch3.24 KBcriz
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

criz’s picture

Category: Bug report » Feature request

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

beauregard’s picture

hm, 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....

criz’s picture

Yes, 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.

beauregard’s picture

ah, 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

criz’s picture

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

beauregard’s picture

Hi

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.

beauregard’s picture

Hi

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

criz’s picture

Adding a setting for displaying the buttons by default is definitely on my todo-list and would be the next task.

criz’s picture

Title: Shariff buttons not shown until node/taxonomy is saved again » Displaying buttons by default (when added as fields without saving the entity)
beauregard’s picture

that's great, thanks for the fast reply

criz’s picture

Status: Active » Needs review
FileSize
3.24 KB

Here is a patch. Needs some feedback if it makes sense this way and the wording is accurate.

beauregard’s picture

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

discipolo’s picture

i 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).

criz’s picture

thx for having a look on this.

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

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.

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

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.

discipolo’s picture

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

  • criz committed 7964667 on 7.x-1.x
    Issue #2475739 by criz: Displaying buttons by default (when added as...
criz’s picture

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

criz’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.