a-ok Posted April 9, 2020 Posted April 9, 2020 I'm needing to add a class `uk-grid-margin` to a `ul.Inputfields` in the admin for @adrian's TableCsvImportExport module https://github.com/adrianbj/TableCsvImportExport/blob/master/TableCsvImportExport.module.php I thought adding `$fieldset->addClass('foobar', 'Inputfields');` would work but it doesn't. I've tried adding this directly to the `$inputfields = new InputfieldWrapper();` also. Any thought if this is possible? See screenshots as a helper.
bernhard Posted April 9, 2020 Posted April 9, 2020 I've no experience with this module, but you can modify all markup inside the <div class="InputfieldContent"> via the Inputfield's render method: $wire->addHookAfter("Inputfield::render", function($event) { $event->return = "<div>foo</div>".$event->return; }); If that does not work for your case it might be due to this issue: https://github.com/processwire/processwire-issues/issues/1141 (if that is also an issue for you it would be great to add your problem description there so that ryan sees that it is not only my problem ? )
adrian Posted April 9, 2020 Posted April 9, 2020 @a-ok - this stuff has always frustrated me - it seems like it's only possible to add classes to an InputfieldWrapper when it's added to a form (which I do in the AdminActions module). I can't get the same code to work for this module. How about I add this: $inputfields = new InputfieldWrapper(); $margin = $this->wire('modules')->get("InputfieldMarkup"); $margin->value = '<div class="uk-margin-small-top"></div>'; $inputfields->add($margin); as a hack to get some space between the Add Row button and the Import/Export CSV section? 1
a-ok Posted April 9, 2020 Author Posted April 9, 2020 @adrian I really appreciate a reply from the main man himself. Your solution sounds good given the situation. I ended up adding a margin top to both the fieldsets in the end, which maybe breaks some of the visual style of the expanded fields, and added margin bottom to the import/export buttons. I also changed the first row names to labels for the export. This is silly stuff; the main thing is the module, which works great and really thankful for the contribution. So thanks! ????
adrian Posted April 9, 2020 Posted April 9, 2020 I suppose the names/labels option should be configurable. I am low on time at the moment - any chance you feel like putting tother a PR to add that and throw in that new top margin hack as well?
a-ok Posted April 11, 2020 Author Posted April 11, 2020 Aiming to do this this weekend. I had another question. Is it possible to configure whether the inputfields for Import and Export are added to the bottom or the top of the PageTable? It currently does this: $inputfields->add($fieldset); return $event->return .= $inputfields->render(); Which simply concats it to the end, but I wonder if there's an alternative? If the PageTable gets long having to scroll to bottom for the Import/Export isn't fun so maybe a configurable option? 1
adrian Posted April 11, 2020 Posted April 11, 2020 @a-ok - I am happy if you want to include a config setting that allows them to be added to the top.
a-ok Posted April 14, 2020 Author Posted April 14, 2020 On 4/11/2020 at 2:21 PM, adrian said: @a-ok - I am happy if you want to include a config setting that allows them to be added to the top. I'm struggling working out how to set the Import/Export fieldsets to the top. Anyone got any idea?
adrian Posted April 14, 2020 Posted April 14, 2020 40 minutes ago, a-ok said: I'm struggling working out how to set the Import/Export fieldsets to the top. Anyone got any idea? return $event->return = $inputfields->render() . $event->return;
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now