Hello, I made a patch that adds additional configuration on the settings page, which allows you to pick for which entities in the current environment you want AddToAny field to appear. Currently this is hard coded in the module.

Comments

yivanov created an issue. See original summary.

yivanov’s picture

StatusFileSize
new5.83 KB
yivanov’s picture

Issue summary: View changes
micropat’s picture

Title: AddToAny for all content Entities » AddToAny field availability for all content Entities in settings
Status: Active » Needs work

Hi Yasen,

Thank you for the patch! A few issues before we commit:

  1. Some entities need to be enabled by default: node, comment, media.
  2. hook_addtoany_entity_types_alter() should be applied in settings as well.
  3. Minor typo: $entity_type_definations should be $entity_type_definitions.
  4. We should have each entity option conveniently hyperlinked to its Manage Display page (using routes like: "entity.entity_view_display.{$bundle_of}.default").

With these issues addressed, the new feature will be perfect for an AddToAny 8.x-1.10 release. :)

yivanov’s picture

StatusFileSize
new6.35 KB

Points 1,2,3 fixed.

Regarding hyperlinking the entities - that's a tricky one. We are enabling the feature by Entity, but not by the bundle. So for example if you have Paragraph Entity with multiple bundles, to which bundle it should point? Also, if you don't have created any bundle to an entity, there shouldn't be any hyperlink.

yivanov’s picture

StatusFileSize
new6.32 KB

Sorry, forgot one test line in the previous patch

micropat’s picture

Thanks Yasen, great point on #4.

if you have Paragraph Entity with multiple bundles, to which bundle it should point?

All of them. :) I think we should parenthetically link to each entity's available bundles like:

[x] Allow for Content (Article, Basic page)
[x] Allow for Paragraph (About this author, Call to action)

Is that doable?

yivanov’s picture

Hi micropat, thanks for the feedback. Here is the patch including #4. For some entities I do not generate links, since they are more specific (Like File, User, Custom menu link). For everything else, it looks good.

yivanov’s picture

StatusFileSize
new7.2 KB
micropat’s picture

Thanks Yasen. In the latest patch I found that the Shortcut entity is problematic:

Symfony\Component\Routing\Exception\RouteNotFoundException: Route "entity.entity_view_display.shortcut.default" does not exist.

yivanov’s picture

Yes, you are right. Unfortunately not all entities follow the same route pattern.

  • micropat committed 6a5997f on 8.x-1.x authored by yivanov
    Issue #2958727 by yivanov: AddToAny field availability for all content...
  • micropat committed b7a1137 on 8.x-1.x
    Issue #2958727: Fix missing route and adjust new entity options.
    
    Since...
micropat’s picture

Status: Needs work » Fixed
Related issues: +#2919756: Add support for all entity D8

I followed up your patch #8 with a fix that whitelists a few popular entities that work with the route pattern, and also made a few more adjustments. Please give the feature a spin in 8.x-1.x-dev.

Thanks again, Yasen!

yivanov’s picture

Status: Fixed » Closed (fixed)

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

othermachines’s picture

After updating I needed to select "Content" and save the configuration in order for my buttons to re-appear. At the very least this should be added to the release notes. Thanks -