Class DOMFieldContent

java.lang.Object
se.conciliate.extensions.publish.DOMFieldContent
All Implemented Interfaces:
FieldContent

public abstract class DOMFieldContent extends Object implements FieldContent
A field content that manipulates a given dom element. The given element will not yet be placed in the DOM, to (somewhat) prevent implementors from walking to parents of the given element and manipulate "up" the tree.
NOTE: It will always be possible to use setInterval/Timeout or ajax calls to manipulate the DOM "later" and that way gain access to the parents of the given element. To prevent this, later revisions may copy the resulting element's structure into the DOM.
Author:
Per-Erik
  • Constructor Details

    • DOMFieldContent

      public DOMFieldContent()
  • Method Details

    • getContentID

      public String getContentID()
      Description copied from interface: FieldContent
      Returns the unique ID of the content type.
      Specified by:
      getContentID in interface FieldContent
      Returns:
      The content type ID.
    • getManipulatorFn

      public abstract String getManipulatorFn()
      Returns a function name that will be invoked when the user navigates the publication to a model or an object.

      To define said function: implement ScriptProvider. That will create a javascript file which will be loaded by the publication.

      Argument the function will receive:
      1. language Uuid of the language to create data for. The function will be called once for every language.
      2. modelOrObject An object with information about the selected model or object.
        { uuid: string }
      3. parent Parent element that the function is free to add content to.
      4. settings An object constructed with the settings from the field.
      5. env Functions and properties related to the environment. See below for more details.


      Contents of the env argument:
      1. webUrl: string URL that points to the directory where WebResourceProvider files end up
      2. scriptUrl: string URL that points to the directory where ScriptProvider files end up
      3. addLanguageListener: (fn: (languageUUID) => void) => void Adds a language listener. Will be called when the user changes the language.
      4. styleTable: (td: HTMLTableElement) => void Styles the given table element.
      Note: This method replaced getManipulator() in 5.3. We changed the name because the contract changed. The number and type of arguments the javascript function receives is now different. And the plugin can no longer use jQUery. In the old publication this function is invoked from mt.ui.model.js:776
      Returns:
      Name of js function to call when model or object is selected in the publication.