This project is not covered by Drupal’s security advisory policy.

Overview

Opens edit forms for selected CCK fields or field groups in modal frames from the node view.

This module is pretty similar in concept as the Popups: Subedit module. However, it's based on the Modal Frame API, meaning the forms are rendered within iframes, therefore these forms do not alter the DOM of the parent page, and provide full support for advanced editing features such as WYSIWYG editors, File uploads, CCK buttons to add more items, Multigroups, etc.

Usage

Once the module has been installed, visit the settings form of the fields or field groups where you want to enable this feature. Here you can choose to reload the current page or just to refresh the target element after a successful edit operation.

When this feature is enabled, a small edit icon will be rendered on the top right corner of the target element, but only to users with the proper edit permissions. Clicking this icon will popup a modal frame with a node edit form that only shows the elements related to the corresponding target element.

Requirements

Developers

This module provides a method to allow external modules implement additional features during the onSubmit callback processing of the modal frame.

Developers can implement the following hook to alter the modal frame arguments to close the dialog. For example, it is possible here to generate additional HTML to update additional content as soon as the dialog is closed.

/**
 * Implementation of hook_modalframe_cck_editor_close_dialog_alter().
 *
 * @param $modalframe_args
 *   An array of arguments that will be forwarded to the onSubmit callback of
 *   the modal frame, client-side. By default, the following elements are
 *   generated by the Modal Frame CCK Editor module:
 *   - 'reload'   Boolean TRUE. It is generated only when the target element
 *                has been configured to reload the page after a successful
 *                edit operation.
 *   - 'content'  HTML string with the updated contents of the target element.
 *                It is generated only when the target element has been configured
 *                to refresh the contents after a successful edit operation.
 *   This array is passed by reference, and it can be modified at will.
 * @param $node
 *   The node object the target element belongs, updated with new information to
 *   reflect the changes being made by the during the edit operation.
 * @param $type
 *   The type of the target element. It can be 'group' or 'field'.
 * @param $info
 *   An array with information about the target element. Its contents depends
 *   on the value of the $type argument.
 *   When $type == 'group', $info contains the $group array of the field group
 *   as generated by the function fieldgroup_groups(), part of the fieldgroup
 *   module.
 *   When $type == 'field', $info contains the $field array of the field as
 *   generated by content_fields(), part of the content module.
 */
function MODULE_modalframe_cck_editor_close_dialog_alter(&$modalframe_args, $node, $type, $info) {
  // Here you can alter the contents of $modalframe_args to suit your needs.
}

To take advantage of the previous hook, developers can also alter the behavior of the onSubmit callback of the modal frame, client-side. To do so, developers can modify the function Drupal.modalFrameCCKEditor.onSubmit() from their own javascript files. The following example describes a technique that can be used for this purpose:

  // Make sure this process is not executed more than once.
  if (!Drupal.myModule.modalFrameCCKEditor_onSubmit) {

    // Save a reference to the original function.
    Drupal.myModule.modalFrameCCKEditor_onSubmit = Drupal.modalFrameCCKEditor.onSubmit;

    // Implement a custom onSubmit callback.
    Drupal.modalFrameCCKEditor.onSubmit = function(url, $element, args, statusMessages) {
      // Here you can do whatever you may need before the default implementation
      // of the onSubmit callback.

      // Now, you can invoke the original onSubmit callback.
      Drupal.myModule.modalFrameCCKEditor_onSubmit(url, $element, args, statusMessages);

      // Here you can do whatever you may need after the default implementation
      // of the onSubmit callback.
    };
  }

For further information about the arguments passed to the original implementation of the onSubmit callback, please consult the Doxygen of this function, that can be found in the file modalframe_cck_editor/js/parent.js

How can you get involved?

Credits

This module has been sponsored by ClubDarwin.net.

Project information

Releases