Add button not respecting Format table in add/edit form setting

Created on 15 February 2024, 9 months ago
Updated 24 April 2024, 7 months ago

Problem

Unchecking configuration checkbox option "Format table in add/edit form" does not prevent "Add" button from appearing beneath tables.

The form_format_table settings value is not being checked prior to the rendering of the button.

Steps to Reproduce

Install the Paragraphs Table module.
Add a dummy paragraph to any of the content type.
In Manage Display select the formatter as "Paragraph table".
In the configuration select or unselect "Format table in add/edit form".
Will have the add button all the time.

Proposed resolution

Add a check for form_format_table on Line 717.

if ($entityId && $setting['form_format_table']==TRUE &&
(($hasPermission && $this->customPermissions['create']) || in_array('administrator', $userRoles)) &&
($cardinality == -1 || $cardinality > $items->count())) {

🐛 Bug report
Status

Closed: works as designed

Version

2.0

Component

Code

Created by

🇦🇺Australia dougiep

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

Merge Requests

Comments & Activities

  • Issue created by @dougiep
  • First commit to issue fork.
  • 🇮🇳India sakthi_dev

    Updated the code with the add condition. Please review.

  • Status changed to Closed: works as designed 9 months ago
  • 🇫🇷France lazzyvn paris

    no, it check the paragraphs permission for the Add button. if you don't want to show it, you can hide it with CSS

  • 🇺🇸United States johnhanley

    I came across this anomaly after installing this otherwise useful module.

    I untick the "Hide line operations" checkbox, but the "Add" link is still displayed underneath the table (when logged in as admin.)

    I agree with the OP. This is counterintuitive when setting field options on the "Manage display" page. Disabling this link should be possible through the interface. Suggesting the link be hidden with CSS seems like a clunky workaround to me.

    In fact, one could argue that providing this type of functionality is beyond the scope of this module's intend purpose.

  • 🇫🇷France lazzyvn paris

    BTW:
    Format table in add/edit form does not mean show and hide add/edit button.
    It only for widget table format form when you add or edit. because sometimes you have too many columns and you want the add/edit field to be vertical and not format the table horizontally.

    The Add link appears if you have the necessary rights to add. paragraph type permission or field permission manage these rights. You have just activated/deleted create rights. I think all admintrator know it as a content type. so no need to add an unnecessary option

Production build 0.71.5 2024