Version: current

# Class DataObjectDecorator

Plug-ins for additional functionality in your DataObjects.

Note: DataObjectDecorators are not actually Decorators in the GoF Design Patterns sense of the word. A better name for this class would be DataExtension. However, in the interests of backward compatibility we haven't renamed the class.

  Extension
  DataObjectDecorator

### Direct known subclasses

`AnnouncementDecorator`, `AssetManagerFolder`, `CustomMenuDecorator`, `DataObjectSubsites`, `DocumentSiteConfig`, `ErrorPageSubsite`, `ExtendGroupDiscount`, `ExtendMemberCart`, `ExtendProductSpecialCatalog`, `FavoriteProductMemberExtention`, `FavoriteProducts`, `FileDataObjectTrackingDecorator`, `AttachedFiles`, `FileImportDecorator`, `FileOversizeDecorator`, `FileSubsites`, `FulltextSearchable`, `GroupSubsites`, `Hierarchy`, `HouseCatalogProductDecorator`, `ImageAutoResize`, `MemberActivation`, `MemberSubsites`, `BaseObjectDecorator`, `MobileContentDecorator`, `NewsletterRole`, `OrderDecorator`, `OrderHandlersDecorator`, `OrderItemDecorator`, `OrderItemVariationDecorator`, `Orders1CExchange_OrdersDecorator`, `PageIcon`, `PageWidgets`, `PaymentMethodShippingDecorator`, `CatalogCatalogLinkedDecorator`, `PaymentOrderExtension`, `PhotoAlbumProductLinkDecorator`, `PhotoAlbumWidgetLinkDecorator`, `Product3DDecorator`, `ProductCatalogCatalogLinkedDecorator`, `ProductOldFieldsDecorator`, `ProductProductLinkedDecorator`, `ProductShippingDecorator`, `RatingExtension`, `SberbankPaymentDecorator`, `CatalogMemberDecorator`, `SeoOpenGraphPageDecorator`, `ShippingMemberDecorator`, `ShippingMethodPaymentDecorator`, `ShippingOrderDecorator`, `SimpleOrderCatalogDecorator`, `SimpleOrderProductDecorator`, `SiteConfigDecorator`, `SiteConfigSubsites`, `SiteConfigWidgets`, `SiteTreeDecorator`, `CatalogOldFieldsDecorator`, `SiteTreeImportDecorator`, `SortableDataObject`, `StaticPublisher`, `SteppedCheckout_PageMessages`, `Translatable`, `Versioned`, `VideoSiteConfig`, `YaMoneyPaymentDecorator`, `CatalogProductLinkedDecorator`, `CatalogRubricsHomepageWidget_CatalogDecorator`, `CommentsSiteConfig`

### Indirect known subclasses

`AssociatedFolderDecorator`, `AuthSiteConfig`, `GoogleSitemapDecorator`, `ImportCatalogSiteConfig`, `ImportSiteConfig`, `ManagerEmailOrderNotification`, `ManagerEmailOrderNotification_SiteConfig`, `MonumentsSiteConfig`, `NewsSiteConfig`, `Orders1CExchange_SiteConfig`, `PaymentSiteConfig`, `ProductCatalogSiteConfig`, `BookingSiteConfig`, `RealtySiteConfigDecorator`, `RsyncMultiHostPublisher`, `SeoOpenGraphSiteConfig`, `ShippingSiteConfig`, `SiteTreeSubsites`, `SMSCOrderNotification`, `SMSCOrderNotification_SiteConfig`, `SMSOrderNotification`, `SMSOrderNotification_SiteConfig`, `WatermarkSiteConfig`, `CartSiteConfig`, `WebylonSiteConfig`, `YMLSiteConfig`, `ClientEmailOrderNotification`, `ClientEmailOrderNotification_SiteConfig`, `ClientVKOrderNotification`, `ClientVKOrderNotification_SiteConfig`, `FilesystemPublisher`, `FindCyrillicSiteConfig`

Abstract
Package: sapphire\model
Located at sapphire/core/model/DataObjectDecorator.php

## Methods summary

`public static` | # `load_extra_statics( string $class, string $extension )` Load the extra static definitions for the given extension class name, called by `Object::add_extension()` Load the extra static definitions for the given extension class name, called by `Object::add_extension()` #### Parameters $class string $class Class name of the owner class (or owner base class) $extension string $extension Class name of the extension class
`public` | # `augmentSQL( `SQLQuery` & $query )` Edit the given query object to support queries for this extension Edit the given query object to support queries for this extension #### Parameters $query SQLQuery $query Query to augment. #### Used by ``DataObject::delete()`` ``DataObject::extendedSQL()`` ``DataObject::instance_get_one()`` ``NewsletterType::delete()``
`public` | # `augmentDatabase( )` Update the database schema as required by this extension. Update the database schema as required by this extension. #### Used by ``DataObject::requireTable()`` ``Image_Cached::requireTable()``
`public` | # `augmentWrite( `SQLQuery` & $manipulation )` Augment a write-record request. Augment a write-record request. #### Parameters $manipulation SQLQuery $manipulation Query to augment. #### Used by ``DataObject::write()``
`public` | # `onBeforeWrite( )` #### Used by ``Announcement::onBeforeWrite()`` ``BookingOrder::onBeforeWrite()`` ``BookingOrder_StatusLog::onBeforeWrite()`` ``BookingService::onBeforeWrite()`` ``DataObject::onBeforeWrite()`` ``EditableSiteAgreementField::onBeforeWrite()`` ``EditableSpamProtectionField::onBeforeWrite()`` ``ErrorPage::onBeforeWrite()`` ``Group::onBeforeWrite()`` ``HomePage::onBeforeWrite()`` ``Import1CLog::onBeforeWrite()`` ``MapObjectGroup::onBeforeWrite()`` ``Monument::onBeforeWrite()`` ``NewsEntry::onBeforeWrite()`` ``Order::onBeforeWrite()`` ``Order_StatusLog::onBeforeWrite()`` ``OrderItem::onBeforeWrite()`` ``OrderServiceOrder::onBeforeWrite()`` ``Page::onBeforeWrite()`` ``Payment::onBeforeWrite()`` ``PayPalPayment::onBeforeWrite()`` ``Permission::onBeforeWrite()`` ``PhotoAlbumItem::onBeforeWrite()`` ``PhotoAlbumPage::onBeforeWrite()`` ``PhotoGalleryPage::onBeforeWrite()`` ``Product::onBeforeWrite()`` ``ProductImportLog::onBeforeWrite()`` ``ProductParamValue::onBeforeWrite()`` ``ProductVariation::onBeforeWrite()`` ``Publication::onBeforeWrite()`` ``RealtyImportLog::onBeforeWrite()`` ``RedirectEntry::onBeforeWrite()`` ``RedirectorPage::onBeforeWrite()`` ``RegionRestriction::onBeforeWrite()`` ``RegistrationPage::onBeforeWrite()`` ``RoomOrder::onBeforeWrite()`` ``RoomRate::onBeforeWrite()`` ``RoomServiceOrder::onBeforeWrite()`` ``SberbankPayment::onBeforeWrite()`` ``ShippingMethod::onBeforeWrite()`` ``SiteTree::onBeforeWrite()`` ``SubsectionMenuWidget::onBeforeWrite()`` ``VideoCategory::onBeforeWrite()`` ``WebylonWidget::onBeforeWrite()`` ``YaMoneyPayment::onBeforeWrite()``
`public` | # `onAfterWrite( )` #### Used by ``BookingOrder::onAfterWrite()`` ``Catalog::onAfterWrite()`` ``DataObject::onAfterWrite()`` ``Material3D_File::onAfterWrite()`` ``MediawebPage_File::onAfterWrite()`` ``MediawebPage_Photo::onAfterWrite()`` ``Member::onAfterWrite()`` ``Order::onAfterWrite()`` ``OrderServiceOrder::onAfterWrite()`` ``Page::onAfterWrite()`` ``Payment::onAfterWrite()`` ``PhotoAlbumPage::onAfterWrite()`` ``RoomOrder::onAfterWrite()`` ``RoomServiceOrder::onAfterWrite()`` ``SimpleOrderForm::onAfterWrite()`` ``SiteTree::onAfterWrite()`` ``Texture3D_File::onAfterWrite()`` ``VirtualPage::onAfterWrite()``
`public` | # `onBeforeDelete( )` #### Used by ``CustomMenuHolder::onBeforeDelete()`` ``CustomMenuItem::onBeforeDelete()`` ``DataObject::onBeforeDelete()`` ``DocumentPage_File::onBeforeDelete()`` ``Material3D_File::onBeforeDelete()`` ``MediawebPage_File::onBeforeDelete()`` ``MediawebPage_Photo::onBeforeDelete()`` ``ProductImportLog::onBeforeDelete()`` ``ProductParam::onBeforeDelete()`` ``RealtyImportLog::onBeforeDelete()`` ``SimpleOrderPage::onBeforeDelete()`` ``SiteTree::onBeforeDelete()`` ``Subsite::onBeforeDelete()`` ``Texture3D_File::onBeforeDelete()`` ``VideoEntry::onBeforeDelete()`` ``WebylonWidget::onBeforeDelete()`` ``WidgetArea::onBeforeDelete()``
`public` | # `onAfterDelete( )`
`public` | # `requireDefaultRecords( )` #### Used by ``DataObject::requireDefaultRecords()`` ``Member::requireDefaultRecords()``
`public` | # `populateDefaults( )` #### Used by ``Announcement::populateDefaults()`` ``AnnouncementHolder::populateDefaults()`` ``CatalogFilter::populateDefaults()`` ``CheckoutPage::populateDefaults()`` ``DataObject::populateDefaults()`` ``HomepageWidget::populateDefaults()`` ``Import1CLog::populateDefaults()`` ``NewsEntry::populateDefaults()`` ``Page::populateDefaults()`` ``PaymentMethod::populateDefaults()`` ``Product::populateDefaults()`` ``ProductImportLog::populateDefaults()`` ``ProductParam::populateDefaults()`` ``Publication::populateDefaults()`` ``RealtyImportLog::populateDefaults()`` ``ShippingMethod::populateDefaults()`` ``UserDefinedForm::populateDefaults()`` ``WebylonWidget::populateDefaults()``
`public` | # `can( mixed $member )` #### Used by ``SiteTree::can()`` If a page is set to inherit, but has no parent, it inherits from {@link SiteConfig}
`public` | # `canEdit( mixed $member )` #### Used by ``Page::canEdit()`` ``SiteTree::canEdit()``
`public` | # `canDelete( mixed $member )` #### Used by ``FavoritePage::canDelete()`` ``HomePage::canDelete()`` ``Page::canDelete()`` ``ProductSearchPage::canDelete()`` ``ProfilePage::canDelete()`` ``RegistrationPage::canDelete()`` ``SimpleOrderForm::canDelete()`` ``SimpleOrderPage::canDelete()`` ``SiteTree::canDelete()`` ``SubsitesSelectorPage::canDelete()``
`public` | # `canCreate( mixed $member )` #### Used by ``CartPage::canCreate()`` ``CheckoutPage::canCreate()`` ``FavoritePage::canCreate()`` ``HomePage::canCreate()`` ``MapObject::canCreate()`` ``MapObjectGroup::canCreate()`` ``NewsArchive::canCreate()`` ``Product::canCreate()`` ``ProductSearchPage::canCreate()`` ``ProfilePage::canCreate()`` ``RegistrationPage::canCreate()`` ``SimpleOrderForm::canCreate()`` ``SimpleOrderPage::canCreate()`` ``SiteTree::canCreate()`` ``Socle::canCreate()`` ``SubsitesSelectorPage::canCreate()``
`public array` | # `extraStatics( )` Define extra database fields Define extra database fields Return a map where the keys are db, has_one, etc, and the values are additional fields/relations to be defined. #### Returns `array` Returns a map where the keys are db, has_one, etc, and the values are additional fields/relations to be defined.
`public` | # `updateCMSFields( `FieldSet` & $fields )` This function is used to provide modifications to the form in the CMS by the decorator. By default, no changes are made. DataObject->getCMSFields(). This function is used to provide modifications to the form in the CMS by the decorator. By default, no changes are made. DataObject->getCMSFields(). Please consider using updateFormFields() to globally add formfields to the record. The method `DataObjectDecorator::updateCMSFields()` should just be used to add or modify tabs, or fields which are specific to the CMS-context. Caution: Use FieldSet->addFieldToTab() to add fields. #### Parameters $fields FieldSet $fields FieldSet with a contained TabSet
`public` | # `updateFrontEndFields( `FieldSet` & $fields )` This function is used to provide modifications to the form used for front end forms. DataObject->getFrontEndFields() This function is used to provide modifications to the form used for front end forms. DataObject->getFrontEndFields() Caution: Use FieldSet->push() to add fields. #### Parameters $fields FieldSet $fields FieldSet without TabSet nesting
`public` | # `updateCMSActions( `FieldSet` & $actions )` This is used to provide modifications to the form actions used in the CMS. DataObject->getCMSActions(). This is used to provide modifications to the form actions used in the CMS. DataObject->getCMSActions(). #### Parameters $actions FieldSet $actions FieldSet
`public` | # `updateSummaryFields( mixed & $fields )` this function is used to provide modifications to the summary fields in CMS by the decorator By default, the summaryField() of its owner will merge more fields defined in the decorator's $extra_fields['summary_fields'] this function is used to provide modifications to the summary fields in CMS by the decorator By default, the summaryField() of its owner will merge more fields defined in the decorator's $extra_fields['summary_fields']
`public` | # `updateFieldLabels( mixed & $lables )` this function is used to provide modifications to the fields labels in CMS by the decorator By default, the fieldLabels() of its owner will merge more fields defined in the decorator's $extra_fields['field_labels'] this function is used to provide modifications to the fields labels in CMS by the decorator By default, the fieldLabels() of its owner will merge more fields defined in the decorator's $extra_fields['field_labels']
`public` | # `flushCache( )` Clear any internal caches. Clear any internal caches.

### Methods inherited from Extension

`__construct()`, `clearOwner()`, `getOwner()`, `get_classname_without_arguments()`, `setOwner()`

### Magic methods summary

## Properties summary

`protected static array` | $decoratable_statics | # Statics on a `DataObject` subclass which can be decorated onto. This list is limited for security and performance reasons. Statics on a `DataObject` subclass which can be decorated onto. This list is limited for security and performance reasons. Keys are the static names, and the values are whether or not the value is an array that should be merged.

### Properties inherited from Extension

`$allowed_actions`, `$class`, `$owner`, `$ownerBaseClass`

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -