Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hidden types are still visible in Matrix-item dropdown #66

Closed
FlorisDerks opened this issue Oct 2, 2023 · 5 comments
Closed

Hidden types are still visible in Matrix-item dropdown #66

FlorisDerks opened this issue Oct 2, 2023 · 5 comments

Comments

@FlorisDerks
Copy link

Description

When hiding a fieldtype inside a Matrixfield, the hidden type will still be visible in the per-item dropdown (in the top right of each matrixfield-item).

Steps to reproduce

  1. Setup a Craft CMS install with MatrixMate
  2. Create a MatrixField with at least 2 fieldtypes
  3. Add the Matrixfield to a section
  4. Add a matrixmate-config file, hide the field for the section:
            'section:article' => [
                'hiddenTypes' => [
                    'lineUp'
                ]
            ]
  1. See that the field is hidden in the main add-bar below the Matrix-field
  2. Add a item to the Matrix
  3. Click the cogwheel in the top right of the new item
  4. See that the hidden field is still visible & selectable there

Expected behavior

Fieldtypes that are hidden in the main add-bar below the Matrix-field, should also be hidden in the dropdown-version.

Actual behavior

Hidden fieldtypes are still visible in the dropdown-version, even though the configured grouping of fields does work. So MatrixMate seems to do it's job for grouping in both places, but 'forgot' to hide the fields in the per-item dropdown.

@mmikkel
Copy link
Member

mmikkel commented Oct 2, 2023

I'm not able to reproduce this. Which versions of Craft and MatrixMate are you running?

@FlorisDerks
Copy link
Author

I'm currently on Craft CMS 4.4.17 with MatrixMate 2.1.3.

However, when i disable all grouping, the hidden type is gone in both the item-dropdown and the add-button below the field. It seems that the grouping and hiding are clashing.

For example, when my config looks like this, the hidden fields are not visible in both places:

return [
    'fields' => [
        'body' => [
            'section:article,section:concert,section:composer,section:playlist' => [
                'hiddenTypes' => [
                    'frequencies',
                    'lineUp',
                    'videoDocumentation',
                ],
            ],
    ],
];

... but when I use something like this, the frequencies/lineUp/videoDocumentation types are hidden in the add-button below, but still visible in the top right dropdown of each Matrix item:

return [
    'fields' => [
        'body' => [
            'section:article,section:concert,section:composer,section:playlist' => [
                'hiddenTypes' => [
                    'frequencies',
                    'lineUp',
                    'videoDocumentation',
                ],
                'groups' => [
                    [
                        'label' => 'Tekst',
                        'types' => ['text', 'frequencies'],
                    ],
                    [
                        'label' => 'Afbeelding',
                        'types' => ['image', 'images', 'giphy', 'lineUp'],
                    ],
                    [
                        'label' => 'Audio/Video',
                        'types' => ['audioFragment', 'videoDocumentation', 'mediaUpload', 'videologPeriod'],
                    ],
                ],
            ],
    ],
];

@tomdavies
Copy link

Can confirm this is the case for me too on Craft 4.5.5 and MatrixMate 2.1.3, i.e. I can't combine hiddenTypes and groups without blocks that should be hidden appearing in the item-dropdown / cog menu on existing blocks.

Removing the groups setting from my MM config restores the hiddenTypes to a working state.

@mmikkel
Copy link
Member

mmikkel commented Nov 10, 2023

This fell off my radar, but was able to reproduce with the additional info, and a fix has been implemented for the next release. Thanks @tomdavies and @FlorisDerks!

@mmikkel
Copy link
Member

mmikkel commented Nov 10, 2023

MatrixMate v. 2.1.4 is out with that fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants