Generate buttons being applied too broadly

Created on 23 July 2023, 11 months ago
Updated 8 November 2023, 8 months ago

Problem/Motivation

Currently the code check for the form_alter in openai_content.module is:

if ($form_object instanceof ContentEntityFormInterface && $account->hasPermission('access openai content tools')) {

The check against "ContentEntityFormInterface" is too broad, and is allowing the form to show in places where it shouldn't, such as Media, Taxonomy Term and Comment creation.

Proposed resolution

My initial thought would be creating an Administative interface listing the "ContentEntityFormInterface" that are available, or more likely, just listing the sites Content Types, and have an Administrator check a box against each one they want it available against.

I'm happy to build this, but wanted peoples feedback before I started.

✨ Feature request
Status

Fixed

Version

1.0

Component

User interface

Created by

πŸ‡¦πŸ‡ΊAustralia Toby Wild

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Toby Wild
  • πŸ‡¦πŸ‡ΊAustralia Toby Wild
  • πŸ‡¨πŸ‡¦Canada mandclu

    I agree with this 100%. I also see cases where the buttons are being added in use cases that don't make sense, such as delete forms.

  • πŸ‡ΊπŸ‡ΈUnited States kevinfunk

    +1. It would be great to have a UI to turn it on/off.

  • @mandclu opened merge request.
  • πŸ‡¨πŸ‡¦Canada mandclu

    I created an MR with a "quick fix" that restricts the buttons to node forms. In itself that's a big improvement IMHO, but I recognize that it's well short of the intent of this issue, so not putting the issue to NR yet.

    I was recently using the Entity Redirect module and it does implement something along the lines of what is proposed here, adding fields to the content type form. So anyone with the time and ambition to take this on could look there for reference on what needs to be done.

  • πŸ‡ΊπŸ‡ΈUnited States kevinquillen

    Yes having a UI where you can flip on per content entity/bundle is ideal. There can be use cases for people with Media, Taxonomy, or custom data entities where they want this (Media with fields, as whitepapers, etc, custom data entities with the same).

  • πŸ‡ΊπŸ‡ΈUnited States kevinquillen

    Immediate issue is fixed, opening a new one to expand the capability.

  • Status changed to Fixed 8 months ago
  • πŸ‡ΊπŸ‡ΈUnited States kevinquillen
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.69.0 2024