Module: PluginAPI/Article

This class is used for communicating with the article, typically setting and getting values of metadata or in the article content itself.

Methods


addAuthors(authors, callback)

Add the given authors to the list of authors
Parameters:
Name Type Description
authors Array List of authors to add
callback function function(Boolean), called when it has been set

addCategories(categories, callback)

Add the given categories to the list of categories
Parameters:
Name Type Description
categories Array List of category IDs to add
callback function function(Boolean), called when the categories have been set

addTag(tag, errorFunction, callback)

Add tag for the article
Parameters:
Name Type Description
tag String Tag to be added
errorFunction function called if error
callback function function(Boolean), called when tag has been set

clearMetaInfo(callback)

Clear the meta information summary
Parameters:
Name Type Description
callback function function(Boolean), called when meta data has been cleared

focusApp(callback)

Give focus to yourself
Parameters:
Name Type Description
callback function function(Boolean), called as the app gets focus

getArticletypeId(callback)

Get the article type of the current article
Parameters:
Name Type Description
callback function function(Int)

getAuthors(callback)

Get the authors set in the article
Parameters:
Name Type Description
callback function function([String]), currently set authors

getByline(callback)

Get the current byline
Parameters:
Name Type Description
callback function function(String), xml string with the current byline

getCurrentContent(callback)

Gets the current article content
Parameters:
Name Type Description
callback function function(Object Content)

getCustomMeta(name, callback)

Retrieve custom meta value for the article
Parameters:
Name Type Description
name String Name of the custom meta value
callback function function(Object), the parameter is an object containing the given custom meta value

getGeolocations(callback)

Get geolocation
Parameters:
Name Type Description
callback function function(Object), retrieves the currently set geo location

getId(callback)

Get the id of the article currently edited
Parameters:
Name Type Description
callback function function(Int), id of the current article

getKeywords(callback)

Get the current set of keywords on the article
Parameters:
Name Type Description
callback function Function to call with the result

getPackageGuid(callback)

Get the guid of the article package currently edited
Parameters:
Name Type Description
callback function function(Int), id of the current article

getPackageId(callback)

Get the guid of the article package currently edited
Parameters:
Name Type Description
callback function function(Int), id of the current article

getProperties(callback)

Fetches a list of all properties available to an article.
Parameters:
Name Type Description
callback function Callback called with an array of property objects.

getPublishedDatetime(callback)

Get the published-date
Parameters:
Name Type Description
callback function function(String), current published datetime

getSelectedCategories(callback)

Get the selected categories
Parameters:
Name Type Description
callback function function([String]), array with category ids

getSource(callback)

Get the source set for the article
Parameters:
Name Type Description
callback function function(String), name of the source

getStatus(callback)

Get the status for the article
Parameters:
Name Type Description
callback function function(String), current status

getTags(callback)

Get tags used in the article
Parameters:
Name Type Description
callback function function([Object Tag]), array with tags connected to an article

maximizeAppWindow(title, onClose)

Maximize the app view
Parameters:
Name Type Description
title String Title to give the maximized view
onClose function Function to call when the window is closed/minimized

removeAuthors(authors, callback)

Remove the given authors from the list of authors
Parameters:
Name Type Description
authors Array List of authors to remove
callback function function([String]), author list as it is after the authors has been removed

removeCategories(categories, callback)

Remove the given categories from the list of categories
Parameters:
Name Type Description
categories Array List of category IDs to remove
callback function function(Boolean), called when the categories have been removed

removeTag(tag, callback)

Remove tag from article
Parameters:
Name Type Description
tag String Tag to remove
callback function function(Boolean), called when tag has been removed

restoreAppWindow(callback)

Restore the app pane to the default size
Parameters:
Name Type Description
callback function Callback to call after everything is done

saveCategories(callback)

Save the currently selected categories
Parameters:
Name Type Description
callback function function(Boolean), called when categories has been saved

setArticletypeId(articletypeId, callback)

Set the article type of the current article
Parameters:
Name Type Description
articletypeId Number The new article type of the article
callback function function(Boolean), called when it has been set

setAuthors(authors, callback)

Set authors for the article
Parameters:
Name Type Description
authors Array List of authors that should be set
callback function function(Boolean), called when it has been set

setByline(byline, save, callback)

Set the byline
Parameters:
Name Type Description
byline String XML version of byline to use
save Boolean If true, force save after updating byline information
callback function function(Boolean), called when it has been set

setCategories(categories, callback)

Set selected categories
Parameters:
Name Type Description
categories Array List of category IDs that should be set
callback function function(Boolean), called when categories have been set

setCurrentContent(content, callback)

Updates current article content
Parameters:
Name Type Description
content String The new content for the article
callback function function(Boolean), called when it has been set

setCustomMeta(name, value, callback)

Set custom meta value for the article
Parameters:
Name Type Description
name String Name of the meta value
value Object Value to set
callback function function()

setGeolocations(geolocations, callback)

Set geolocation
Parameters:
Name Type Description
geolocations Object The location to set
callback function function(Boolean), called when it has been set

setKeywords(keywords, callback)

Set the keyword-list on the article
Parameters:
Name Type Description
keywords Array List of keywords to add
callback function Function to call when keywords have been set

setMainCategory(category, callback)

Set the main category of the current article
Parameters:
Name Type Description
category Number The ID of the category to set as the main category
callback function function(Boolean), called when the main category has been set

setProperties(properties, callback)

Updates and saves one or more property values. The input is a simple object with property names and their new value. The supplied callback is called with an updated list of properties.
Parameters:
Name Type Description
properties Object An object of property names and corresponding values.
callback function Callback called with an updated list of properties.
Example
PluginAPI.Article.setProperties({
    fooProperty: "bar",
    barProperty: "foo"
}, function(properties) {
    // Returns a complete and updated list of properties.
})

setProperty(name, value, callback)

Updates and saves a single property.
Parameters:
Name Type Description
name String The property to update.
value String The updated value.
callback function Callback called with an updated list of properties.

setPublishedDatetime(published, callback)

Set the published-date
Parameters:
Name Type Description
published String Date to be set (YYYY-MM-DD HH:MM:SS)
callback function function(Boolean), called when done

setSource(value, callback)

Set the source for the article
Parameters:
Name Type Description
value String The new value to be set as source
callback function function(Boolean), called when the source has been set

setStatus(status, callback)

Set the status for the article
Parameters:
Name Type Description
status String The new status to be set (draft, waiting, published)
callback function function(Boolean), called when the source has been set

setTags(tags, save, callback)

Set tags for the article
Parameters:
Name Type Description
tags Array List of tags that should be set
save Boolean Set to true to force save once the tags are updated
callback function function(Boolean), called when tags have been set

startApp(name, options, callback)

Start the given app
Parameters:
Name Type Description
name String Name of the app from settings.php
options Object Options for initializing the app
callback function function(Boolean), called after app is started

stopApp(name)

Stop the given app
Parameters:
Name Type Description
name String Name of the app from settings.php