Skip to content
Sitemason - Build on Us

Content Class Reference

Methods

addContentItemAfter

(content item object) addContentItemAfter (object)
A content item config object defining a new content item.
The new content item object.

Information

addContentItemAfter() creates a new content item, placing it after the current item.

	var newContentItem = contentItem.addContentItemAfter(
    {
        type:   'field',
        label:  'Subtitle',
        name:   'subtitle'
    }
);	

addContentItemBefore

(content item object) addContentItemBefore( object );
A content item config object defining a new content item.
The new content item object.

Information

addContentItemBefore() creates a new content item, placing it before the current item.

	var newContentItem = contentItem.addContentItemBefore(
    {
        type:   'field',
        title:  'Subtitle',
        name:   'subtitle'
    }
);	

remove

remove ()

Information

Removes the current content item.

	contentItem.remove();	

replace

(content item object) replace (object)
A content item config object defining a new content item.
The new content item object.

Information

replace() replaces the current item with a new content item.

	var newContentItem = contentItem.replace(
    {
        type:   'field',
        label:  'Subtitle',
        name:   'subtitle'
    }
);	

set

set (string, string)
The first parameter is the name of the value to be set. The second is the value to which it should be set.

Information

Change an attribute of a content item object. Currently, only changing the 'label' is supported.

	contentItem.set('label', 'Headline');