Вы здесь

Modal Frame CCK Editor

Открытие форм правки дополнительных полей в накладываемых формах.

Модуль Modal Frame CCK Editor позволяет редактировать поля CCK в накладываемых поверх страницы формах. Этот модуль похож на Popups: Subedit, но основан на Modal Frame API, что означает то, что формы показываются в iframe, таким образом, эти формы не изменяют DOM страницы и предоставляют полную поддержку для расширенных возможностей редактирования, таких как текстовые редакторы, загрузка фалов, кнопки CCK и добавление дополнительных пунктов, мультигруппы и так далее.

После установки модуля, перейдите на страницу параметров формы полей или группы полей, для которых вы хотите использовать этот модуль. Здесь можно выбрать перезагрузку текущей страницы или только обновление целевых элементов после завершения редактирования.

Когда использование модуля с формой разрешено, то у неё показывается маленький значок в верхнем правом углу для целевого элемента, которым могут воспользоваться для редактирования формы только те пользователи, которые обладают соответствующими правами.

Модуль предоставляет метод, который позволяет внешним модулям добавлять свои возможности при обработке вызова onSubmit в накладываемом фрейме. Разработчики могут применять следующий хук для изменения аргументов всплывающего фрейма для закрытия диалога. Например, возможно здесь генерировать дополнительный HTML-код для обновления дополнительного содержания как только диалог будет закрыт.

<?php
/**
* 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.
}
?>

Получить преимущество из предыдущего хука разработчики могут также изменив поведение вызова onSubmit накладываемого фрейма на стороне клиента. Чтобы сделать это, разработчик может изменить функцию Drupal.modalFrameCCKEditor.onSubmit() в своём ЯваСкрипт-файле. Следующий пример описывает технику, которая может использоваться для этой цели:

  // 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.
    };
  }

Зависит от: 
Группа проекта: