\ExternalContentItem
Parent class for all ExternalContentItems.
On construction, an ExternalContentItem subclass must load data from the
remote repository through the appropriate API layer as returned by getRemoteRepository()
from the external content source. It is then up to the content item to
store that data in a way that can be used by the rest of SilverStripe.
For now, the ExternalContentItem provides the remoteProperties map for
storing things, with __get and __set magic methods for retrieving values.
Some implementations may choose to store the data in a separate object (for
example, the AlfrescoContentItem implementation simply stores things in its
contained CMIS object and maps back and forward from that).
- Author: Marcus Nyeholt <marcus@silverstripe.com.au>
- License: BSD License http://silverstripe.org/bsd-license
Synopsis
class ExternalContentItem
extends DataObject
{
- // members
- private static array $db = ;
- private static array $extensions = ;
- private static $icon = NULL;
- protected $ownerId;
- protected $externalId;
- protected ExternalContentSource $source;
- private ArrayList $children;
- protected $remoteProperties;
- // methods
- public void setOwnerId()
- public void __construct()
- public string getExternalId()
- public String getType()
- protected void init()
- public ExternalContentSource getSource()
- public boolean exists()
- public String Link()
- public String RelativeLink()
- public string DownloadLink()
- public ExternalContentImporter getContentImporter()
- public array allowedImportTargets()
- public void Content()
- public void streamContent()
- public int numChildren()
- public ArrayList stageChildren()
- public void Children()
- public void getCMSFields()
- public void editableFieldMapping()
- public void remoteWrite()
- public void canEdit()
- public void canView()
- public bool canImport()
- public void __set()
- public void __get()
- public void hasField()
- public array getRemoteProperties()
- public void instance_get()
- public void instance_get_one()
- public void write()
- public void delete()
- public void setCastedField()
- public string CMSTreeClasses()
- public string CMSTreeCSS()
- public string getTreeTitle()
Hierarchy
Extends
- DataObject
Members
private
- $children
—
ArrayList
The child nodes of this item - $db
- $extensions
- $icon — string
protected
- $externalId
—
mixed
The ID of this item in the remote system - $ownerId
- $remoteProperties
—
array
The list of properties loaded from a remote data source - $source
—
ExternalContentSource
The content source object that this item belongs to
Methods
protected
- init() — Initialise this object based on its source object
public
- __construct() — Create a new external content item.
- CMSTreeCSS() — Return the CSS declarations to apply to nodes of this type in the CMS tree
- CMSTreeClasses() — Return the CSS classes to apply to this node in the CMS tree
- Children() — Handle a children call by retrieving from stageChildren
- Content() — An overrideable method to return the arbitrary 'content' of this node. Child classes should implement their own version
- DownloadLink() — Where this can be downloaded from
- Link() — Return a URL that simply links back to the externalcontentadmin class' 'view' action
- RelativeLink() — Return a URL that simply links back to the externalcontentadmin class' 'view' action
- __get() — Return from the parent object if it's not in here...
- __set() — Overriding the default behaviour to not worry about how it needs to work with the DB
- allowedImportTargets() — Where can this content be imported to?
- canEdit() — We flag external content as being editable so it's accessible in the backend, but the individual implementations will protect users from editing... for now
- canImport() — Returns whether or not this source can be imported, defaulting to the linked source's permission.
- canView() — Is this item viewable?
- delete() — Remove this object from the database. Doesn't do anything if this object isn't in the database.
- editableFieldMapping() — Return a mapping of remote field name => field type
- exists() — Override to ensure exists handles things properly
- getCMSFields() — For now just show a field that says this can't be edited
- getContentImporter() — Get the importer for this content item
- getExternalId() — Return the ID of the item in its remote system
- getRemoteProperties() — Get all the remote properties
- getSource() — Get the content source for this item
- getTreeTitle() — getTreeTitle will return two <span> html DOM elements, an empty <span> with the class 'jstree-pageicon' in front, following by a <span> wrapping around its MenutTitle
- getType() — Get the type of this external object.
- hasField() — Override to let remote objects figure out whether they have a field or not
- instance_get() — Perform a search query on this data source
- instance_get_one() — Retrieve a single record from this data source
- numChildren() — Always return at least one as we never know til we load whether this item has children or not
- remoteWrite() — Write back to the content source
- setCastedField() — Save content from a form into a field on this data object.
- setOwnerId()
- stageChildren() — Overridden to load all children from a remote content source instead of this node directly
- streamContent() — Called to stream this content item (if it is streamable)
- write() — Write the current object back to the database. It should know whether this is a new object, in which case this would be an insert command, or if this is an existing object queried from the database, in which case thes would be