Jump to content

provide an edit-form in a modal popup


Recommended Posts

I'm trying to create a module that - among other things - provides a function to edit and add new fields.
Instead of just linking to the regular field-editor, I want to open it in a modal window, so the user stays on my page rather than being redirected to the field-editor.
I found the «AdminThemeDefaultHelpers» which look like they'd provide a way to do this, but when I try to implement that in my module, I get all sorts of errors... (Call to a member function get() on null in /web/wire/modules/AdminTheme/AdminThemeDefault/AdminThemeDefaultHelpers.php on line 15)

This is the code I'm using to call the helpers:

require_once(wire('config')->paths->modules. "/AdminTheme/AdminThemeDefault/AdminThemeDefaultHelpers.php");

        $helpers = $this->wire(new AdminThemeDefaultHelpers());

The module itself is a backend module (extends Process implements Module, ModuleConfig)

I'm pretty sure I'm doing something wrong... ;)

Any guidelines available on this topic?

  • Like 1
Link to comment
Share on other sites

Ok, found it out...

In the init-function of my module, I call

$this->modules->get('JqueryUI')->use('modal');

Then I simply add «pw-modal» as a class to my link to the field-editor and viola, it opens in a modal window...
Link for a new Field looks like this: 

<a href="/processwire/setup/field/edit?id=new&fieldgroup_id=new&modal=1&process_template=1&name=myTestField" class="pw-modal addNewField">New Field</a>

 

  • 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...