Difference between revisions of "AppSuite:Modifying forms by using extension points"

(available extensions of a known point)
Line 29: Line 29:
 
// get all available extensions of a known extensionpoint
 
// get all available extensions of a known extensionpoint
 
require('io.ox/core/extensions').point('io.ox/contacts/edit/personal').all();
 
require('io.ox/core/extensions').point('io.ox/contacts/edit/personal').all();
 +
</pre>
 +
 +
==some options for modification==
 +
 +
<pre class="language-javascript">
 +
// replace a existing extension
 +
require('io.ox/core/extensions').point('io.ox/contacts/edit/personal').replace({
 +
    id: "first_name",
 +
    draw: function () {
 +
        this.append(
 +
            $("<div>").addClass("title").text("Hello World!")
 +
        );
 +
    }
 +
});
 
</pre>
 
</pre>
  
 
[[Category:AppSuite]]
 
[[Category:AppSuite]]
 
[[Category:UI]]
 
[[Category:UI]]

Revision as of 14:12, 10 April 2013

Summary: This articles covers how to apply different changes to forms via modifying its extensionpoints and extensions.

The edit contact form of the contacts app is constructed by a set of extensionpoints. Each extensionpoint controls a single aspect - like the the input field for first name or the user picture - of the contact.

To apply modifications the id of the point and the extension is needed.

For a quick overview of the available extensionpoints and extensions you can use the browser console.

available extensionpoints

 
// get all available extensionpoints
require('io.ox/core/extensions').keys();
 
// you can filter down the list by using regular expression 
_(require('io.ox/core/extensions').keys()).filter(function (point) {
    if (/io.ox\/contacts\/edit/.test(point)) {
        return point;
    }
});

available extensions of a known point

 
// get all available extensions of a known extensionpoint
require('io.ox/core/extensions').point('io.ox/contacts/edit/personal').all();

some options for modification

 
// replace a existing extension
require('io.ox/core/extensions').point('io.ox/contacts/edit/personal').replace({
    id: "first_name",
    draw: function () {
        this.append(
            $("<div>").addClass("title").text("Hello World!")
        );
    }
});