The wysiwyg plugin currently has the property method "insert_form"
This does a lot of work:

  • Inserts Form elements
  • Builds the buttons
  • Builds actual shortcode code

The problem I am having is that I have created a JavaScript "column builder" and this is set as a form mark-up element so that it renders and the end user can interact with it to build columns visual.

This JavaScript build the column shortcode form me and then returns it so i can simply insert it as is. I will be making more JavaScript GIU widgets to help with other shortcodes such as tabs, slideshows, image boxes etc.. and some will return the code already assembled.

In order to achieve this I need to either create my own shortcode wysiwyg plugin, or I need to update the current one to allow for more options.

  • I would like to separate the buttons so they are stand alone.
  • Move some of the variables around to a global scope (within the object name space)
  • Create a "get_code" function that generates the shortcode AND/OR looks for an existing form field called "#edit-custom" which will contain an already generated short code that has been added via another widget.

The whole thing could be broken down further and cleaner, and if this patch is worth adding I will work on more.

This patch includes some (not all) the changes that JurriaanRoelofs made here: http://drupal.org/node/1716806

Comments

gamelodge’s picture

And here is the patch

-- More that should be done are things like:
allowing variables to be set dynamically for example to allow things like callback functions for the insert button.
trigger events to let external systems know when form is loaded/ready.
etc...

denes.szabo’s picture

Status: Active » Needs work

Can you reroll this aganinst the latest dev version? Can you give me a test code, anything to check the feature. I would like to see the result of this patch. THX!

denes.szabo’s picture

Issue summary: View changes

Fix spelling

denes.szabo’s picture

Project: Shortcode » Shortcode for Wysiwyg

Moved to the shortcode_wysiwyg project.