Jump to content

Minimal Fieldset


Robin S
 Share

Recommended Posts

Minimal Fieldset

Adds a config option to Fieldset/FieldsetGroup/FieldsetPage to render the fieldset without label or padding in Page Edit. When a neighbouring field in the same row is taller than the fieldset the extra height is distributed evenly among rows within the fieldset.

Requires ProcessWire v3 and AdminThemeUikit.

Why?

This module allows you to create layouts in Page Edit that would not be possible without it. It's useful when you want a layout that has two or more fields as rows that are themselves within a row in Page Edit.

It's also useful when you have some fields that you want to add to a template as a group (i.e. via FieldsetGroup or FieldsetPage) but having a heading and visible wrapper for the fieldset in Page Edit would be redundant.

Example:

template-fields

page-edit

Installation

Install the Minimal Fieldset module.

Usage

In the field settings for any Fieldset/FieldsetGroup/FieldsetPage, tick the "Remove label and padding for this fieldset" checkbox.

 

https://github.com/Toutouwai/MinimalFieldset
https://modules.processwire.com/modules/minimal-fieldset/

  • Like 23
  • Thanks 2
Link to comment
Share on other sites

  • 2 weeks later...

Wonderful! Well done and thank you for taking the time and releasing this. I've been thinking about the exact same thing for a while now.

Could you make the vertical spacing optional, via another checkbox maybe? I have quite a few layouts where the secondary column has a lot fewer inputs and would prefer to have them on top.

Link to comment
Share on other sites

2 hours ago, d'Hinnisdaël said:

Well done and thank you for taking the time and releasing this.

Glad you like it. 🙂

2 hours ago, d'Hinnisdaël said:

Could you make the vertical spacing optional, via another checkbox maybe?

Done, in v0.1.1.

  • Like 5
Link to comment
Share on other sites

Thanks for the module. Maybe this could be in the core... Any chance of supporting AdminThemeDefault? If not, then you could possibly check if the user has Uikit theme active before injecting css file and applying classes?

  • Like 2
Link to comment
Share on other sites

34 minutes ago, matjazp said:

Any chance of supporting AdminThemeDefault?

No, AdminThemeDefault and AdminThemeReno do some crazy JS spacer stuff to equalise field heights. This module relies on the flex layout used in AdminThemeUikit.

 

34 minutes ago, matjazp said:

If not, then you could possibly check if the user has Uikit theme active before injecting css file and applying classes?

Possibly, but not sure what the point of that would be. The module already requires AdminThemeUikit in order to be installed and also clearly states that in the readme. And if you have AdminThemeUikit installed but you allow some users to choose a different theme then using this module is not going to be a good idea. Best just not to install it in that case.

  • Like 1
Link to comment
Share on other sites

Field exports don't seem to work properly with the module enabled. When exporting a Fieldset (via Setup » Fields » Export), I get the following error: Call to a member function add() on null (MinimalFieldset.module, line 74). $wrapper seems to be unset in this specific context.

Uninstalling the module gets rid of the exception. Could you check if you see the same thing (I'm on 3.0.117) or if I just have something misconfigured?

  • Like 2
Link to comment
Share on other sites

  • 2 weeks later...

I installed the module (v0.1.3) on an existing site, running PW in the current Master release, v3.0.98 on Php 7.2.
After enabling the module for a regular Fieldset (Open) I kept running into this error:

Method InputfieldFieldsetOpen::wrapClass does not exist or is not callable in this context

This is because Inputfield::wrapClass() has not been added to the Master yet, it is only available on the ProcessWire dev release (currently 3.0.119).

The fix for this issue is to replace lines 107-109 with:

// Add classes to inputfield
$inputfield->wrapClass .= ' MinimalFieldset';
if(!$field->no_spacing) $inputfield->wrapClass .= ' MinimalFieldsetSpaced';

 

  • Like 2
Link to comment
Share on other sites

  • 1 year later...

I just want to say I love this module. It means I can have repeatermatrices made up of fieldsets, while also using those fieldsets on their own elsewhere, with much less clutter. Thanks for making it!

Would it not make more sense though for the provided option to be added to Input > Admin theme settings (Uikit) ? Then also it could be overriden from within a template/repeater field group. I think this would be really helpful because while you're likely to not want the title/padding when loading a fieldset within a repeater matrix, you're likely to want it when loading a fieldset in a more standard context.

  • Like 1
Link to comment
Share on other sites

12 hours ago, cjx2240 said:

I just want to say I love this module.

Thanks, I'm glad you like it. 🙂

12 hours ago, cjx2240 said:

Would it not make more sense though for the provided option to be added to Input > Admin theme settings (Uikit) ? Then also it could be overriden from within a template/repeater field group.

The "Admin theme settings (Uikit)" options don't exist for the standard Fieldset fieldtype (FieldsetOpen) so that wouldn't work, and in any case the location of the module settings fields doesn't determine whether or not they can appear in template context.

But in the newly released v0.1.6 I have added support for defining the Minimal Fieldset settings in template context so this should cover what you're wanting to do.

  • Like 5
Link to comment
Share on other sites

  • 9 months later...
12 hours ago, cst989 said:

Just fyi this breaks a bit if you put a description for the fieldset and also tick the box. Maybe just in the latest version of PW

Thanks. I assume you mean if you accidentally add a description because the point of this module is that it hides the fieldset that surrounds the fields so you wouldn't expect to be able to see any description. In v0.1.7 the module explicitly hides any description and notes for the fieldset so if these are accidentally present they won't disrupt the intended layout.

  • Like 2
  • Thanks 1
Link to comment
Share on other sites

  • 3 weeks later...

Sorry I should've been clearer, what I was seeing was that the description was still visible, but the padding broke and spacing at the bottom of the fieldset was out of alignment.

The way I'm trying to use minimal fieldset is like this:

image.png.ea13aa60f92310cb379fa1db647f735b.png

For me, a description would still be kinda handy to have - but I appreciate it would need new CSS logic and that's more complicated than it seems. And I understand if this isn't exactly the aim of the module. 0.1.7 certainly fixes the visual hiccup pictured, so thanks for that 🙂 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...