Version: current

# Class ViewableData

A ViewableData object is any object that can be rendered into a template/view.

A view interrogates the object being currently rendered in order to get data to render into the template. This data is provided and automatically escaped by ViewableData. Any class that needs to be available to a view (controllers, `DataObject`s, page controls) should inherit from this class.

  Object
  ViewableData implements IteratorAggregate

### Direct known subclasses

`Aggregate`, `ArrayData`, `DBField`, `Email`, `Form_FieldMap`, `LiveCalendarWidget`, `ModelViewer_Field`, `ModelViewer_Model`, `ModelViewer_Relation`, `MonthNavigator`, `NestedForm`, `RecipientImportField_Cell`, `BulkLoader`, `RequestHandler`, `RestfulService`, `RSSFeed`, `RSSFeed_Entry`, `SideReportView`, `SimpleOrderButton`, `SS_HTMLValue`, `SS_Report`, `TableListField_Item`, `TabularStyle`, `CalendarWidget`, `Versioned_Version`, `ViewableData_Customised`, `ViewableData_Debugger`, `CartOrderButton`, `DashboardPlugin`, `DataDifferencer`, `DataObject`, `DataObjectManagerAction`, `DataObjectSet`

### Indirect known subclasses

`AdditionalMenuWidget`, `AdditionalMenuWidget_Item`, `AnnouncementHolder`, `CustomPayment`, `DailyTask`, `DashboardAdmin`, `DatabaseAdmin`, `DatalessField`, `DataObjectFileTracking`, `DataObjectManager`, `DataObjectManager_Controller`, `DataObjectManager_Item`, `DataObjectManager_ItemRequest`, `AnnouncementHolder_Controller`, `DataObjectManager_Popup`, `Date`, `DateField`, `DateField_Disabled`, `DatePickerField`, `DatePickerField_Controller`, `DatetimeField`, `DatetimeField_Readonly`, `DBLocale`, `Decimal`, `AssetAdmin`, `DeleteEmptyAssociatedFoldersTask`, `DeleteUnconfirmTask`, `DevelopmentAdmin`, `DocPage`, `DocPage_Controller`, `DocumentDirection`, `DocumentHaving`, `DocumentItem`, `DocumentPage_File`, `DocumentPageFiles_Manager`, `AssetManager`, `DocumentSearchForm`, `DocumentsPage`, `DocumentsPage_Controller`, `DocumentType`, `Double`, `DropdownField`, `EditableCheckbox`, `EditableCheckboxGroupField`, `EditableCountryDropdownField`, `EditableDateField`, `AssetTableField`, `EditableDateTimeField`, `EditableDropdown`, `EditableEmailField`, `EditableFileField`, `EditableFormField`, `EditableFormHeading`, `EditableHiddenField`, `EditableLiteralField`, `EditableMemberListField`, `EditableMultipleOptionField`, `AuthFormWidget`, `EditableNumericField`, `EditableOption`, `EditablePhoneField`, `EditableRadioField`, `EditableSiteAgreementField`, `EditableSpamProtectionField`, `EditableTextField`, `EditableTimeField`, `Email_BounceHandler`, `Email_BounceRecord`, `AutoCompleteField`, `EmailField`, `Enum`, `Epitaph`, `ErrorPage`, `ErrorPage_Controller`, `Event`, `Event_Controller`, `EventCalendarWidget`, `EventHolder`, `EventHolder_Controller`, `AutocompleteTextField`, `FaqAdmin`, `FaqHolder`, `FaqHolder_Controller`, `FAQHomepageWidget`, `FaqQuestion`, `FaqSection`, `FaqSection_Controller`, `FAQSidebarWidget`, `FavoritePage`, `FavoritePage_Controller`, `BannerWidget`, `FavoriteProductsSidebarWidget`, `FeedbackHomepageWidget`, `FieldEditor`, `FieldGroup`, `FieldSet`, `File`, `FileComplexTableField`, `FileDataObjectManager`, `FileDataObjectManager_Controller`, `FileDataObjectManager_Item`, `BannerWidget_Item`, `FileDataObjectManager_ItemRequest`, `FileDataObjectManager_Popup`, `FileField`, `FileIFrameField`, `FileList`, `FillTechTitleTask`, `FindCyrillic`, `FindCyrillic_Controller`, `FixedShippingMethod`, `Float`, `Address`, `BaseObjectCategory`, `FlowerGarden`, `FlowerGarden_Size`, `FLV`, `Folder`, `Folder_UnusedAssetsField`, `ForeignKey`, `Form`, `FormAction`, `FormAction_WithoutLabel`, `FormField`, `BatchProcess_Controller`, `GoogleSitemap`, `Group`, `GroupCsvBulkLoader`, `GroupedDropdownField`, `GroupImportForm`, `Guestbook`, `Guestbook_Controller`, `GuestbookAdmin`, `GuestbookAdmin_CollectionController`, `GuestbookEntry`, `BigFilesReport`, `GuestbookWidget`, `HasManyComplexTableField`, `HasManyComplexTableField_Item`, `HasManyDataObjectManager`, `HasManyDataObjectManager_Item`, `HasManyFileDataObjectManager`, `HasManyFileDataObjectManager_Item`, `HasOneComplexTableField`, `HasOneComplexTableField_Item`, `HasOneDataObjectManager`, `BookingAdminPage`, `HasOneDataObjectManager_Item`, `HasOneFileDataObjectManager`, `HasOneFileDataObjectManager_Item`, `HeaderField`, `HiddenField`, `HiddenFieldSet`, `HomePage`, `HomePage_Controller`, `HomepageWidget`, `HomepageWidgetArea`, `BookingAdminPage_Controller`, `HourlyTask`, `HouseCatalogSearchWidget`, `HouseCatalogSearchWidget_Controller`, `HTMLBlockHomepageWidget`, `HTMLBlockSidebarWidget`, `HTMLDropdownField`, `HtmlEditorField`, `HtmlEditorField_Readonly`, `HtmlEditorField_Toolbar`, `HTMLText`, `BookingOrder`, `HTMLVarchar`, `Image`, `Image_Cached`, `ImageAssetManager`, `ImageDataObjectManager`, `ImageDataObjectManager_Item`, `ImageDataObjectManager_ItemRequest`, `ImageDataObjectManager_Popup`, `ImageEditor`, `ImageField`, `BookingOrder_StatusLog`, `ImageFormAction`, `Import1C_Controller`, `Import1CLog`, `Import1CLog_File`, `Import1CLog_Item`, `Import1CLog_Task`, `ImportCatalog1C_Controller`, `ImportCatalog1C_PriceType`, `ImportCatalog1C_ProcessTask`, `ImportCatalog1C_ProductProp`, `BookingOrderAdmin`, `ImportCatalog1C_ProductProp_Admin`, `InlineFormAction`, `InlineFormAction_ReadOnly`, `InstallerTest`, `Int`, `JSTestRunner`, `LabelField`, `LanguageDropdownField`, `LastDoc_Controller`, `LeftAndMain`, `BookingOrderAdmin_CollectionController`, `ListboxField`, `LiteralField`, `LiveCalendarWidget_Controller`, `LoggerAdmin`, `LoggerAdmin_CollectionController`, `LoggerAdmin_RecordController`, `LoginAttempt`, `LoginForm`, `LogItem`, `LookupField`, `BookingPage`, `ManyManyComplexTableField`, `ManyManyComplexTableField_Item`, `ManyManyDataObjectManager`, `ManyManyDataObjectManager_Item`, `ManyManyFileDataObjectManager`, `ManyManyFileDataObjectManager_Item`, `MapObject`, `MapObject_Controller`, `MapObjectGroup`, `MapObjectGroup_Controller`, `AdvancedSearchForm`, `BookingPage_Controller`, `MapPage`, `MapPage_Controller`, `Material3D_File`, `Mediaweb3DPageFiles_Manager`, `MediawebForm`, `MediawebPage`, `MediawebPage_Controller`, `MediawebPage_File`, `MediawebPage_Image`, `MediawebPage_Photo`, `BookingPaymentMethod`, `MediawebPage_Popup`, `MediawebPageFiles_Manager`, `MediawebPagePhoto_Manager`, `MediawebPageTexture_Manager`, `Member`, `Member_ChangePasswordEmail`, `Member_ForgotPasswordEmail`, `Member_GroupSet`, `Member_ProfileForm`, `Member_SignupEmail`, `BookingService`, `MemberCsvBulkLoader`, `MemberImportForm`, `MemberLoginForm`, `MemberPassword`, `MemberTableField`, `MemberTableField_Item`, `MemberTableField_ItemRequest`, `MemberTableField_Popup`, `ModelAdmin`, `ModelAdmin_CollectionController`, `Boolean`, `ModelAdmin_RecordController`, `ModelAsController`, `ModelViewer`, `ModelViewer_Module`, `Money`, `MoneyField`, `MonthlyTask`, `Monument`, `Monument_Controller`, `Monument_PolishingTextField`, `BouncedList`, `MonumentAdmin`, `MonumentCatalog`, `MonumentCatalog_Controller`, `MonumentForm`, `MonumentForm_Controller`, `MonumentGalleryItem`, `MonumentPhotoGallery`, `MP3`, `MultiEnum`, `MultiUploadControls`, `BrokenLinksReport`, `MultiUploadField`, `MyRangeField`, `NewDocumentsAdmin`, `NewsArchive`, `NewsArchive_Controller`, `NewsEntry`, `NewsEntry_Controller`, `NewsHolder`, `NewsHolder_Controller`, `NewsHomepageWidget`, `ButtonsBlockHomepageWidget`, `Newsletter`, `Newsletter_Email`, `Newsletter_Recipient`, `Newsletter_SentRecipient`, `NewsletterAdmin`, `NewsletterEmailBlacklist`, `NewsletterList`, `NewsletterType`, `NewsSidebarWidget`, `NonUsedFilesReport`, `ButtonsBlockHomepageWidget_Item`, `Notification`, `NullableField`, `NumericField`, `OptionsetField`, `Order`, `Order_CancelForm`, `Order_StatusLog`, `OrderAdmin`, `OrderAdmin_CollectionController`, `OrderAdmin_RecordController`, `CallBackWidget`, `OrderDataObject`, `OrderExporter`, `OrderItem`, `OrderItemField`, `Orders1CExchange_Controller`, `OrderService`, `OrderServiceOrder`, `Page`, `Page_Controller`, `PageComment`, `CarouselHomepageWidget`, `PageComment_Controller`, `PageCommentInterface`, `PageCommentInterface_Controller`, `PageCommentInterface_Form`, `PageMenuWidget`, `PasswordField`, `Payment`, `Payment_Handler`, `PaymentAdmin`, `PaymentAdmin_CollectionController`, `AdvancedSliderHomepageWidget`, `CarouselHomepageWidget_Item`, `PaymentMethod`, `PaymentType`, `PayPalPayment`, `PayPalPayment_Handler`, `Percentage`, `Permission`, `PermissionCheckboxSetField`, `PermissionCheckboxSetField_Readonly`, `PermissionRole`, `PermissionRoleCode`, `Cart_Controller`, `Person`, `PhoneField`, `PhoneNumberField`, `PhotoAlbumHomepageWidget`, `PhotoAlbumItem`, `PhotoAlbumManager`, `PhotoAlbumManager_Controller`, `PhotoAlbumManager_Popup`, `PhotoAlbumPage`, `PhotoAlbumPage_Controller`, `CartPage`, `PhotoGalleryHomepageWidget`, `PhotoGalleryHomepageWidget_Item`, `PhotoGalleryPage`, `PhotoGalleryPage_Controller`, `PhotoGalleryWidget`, `PhpCaptchaField`, `Polishing`, `Poll`, `PollAnswer`, `PollPage`, `CartPage_Controller`, `PollSidebarWidget`, `PortraitType`, `PostVKNotificationQueueTask`, `PriceListWidget`, `PrimaryKey`, `PrintableTransformation_TabSet`, `Product`, `Product_Controller`, `ProductCatalogImportTask`, `ProductImport1CAdmin`, `CartTableListField`, `ProductImport1CAdmin_CollectionController`, `ProductImportAdmin`, `ProductImportAdmin_CollectionController`, `ProductImportLog`, `ProductImportLog_Item`, `ProductParam`, `ProductParamValue`, `ProductParamValue_BoolValueField`, `ProductParamValue_MultiValueField`, `ProductParamValue_MultiValueSetField`, `CartTableListField_Item`, `ProductParamValue_ValueField`, `ProductSearchPage`, `ProductSearchPage_Controller`, `ProductVariation`, `ProfilePage`, `ProfilePage_Controller`, `ProgressBar`, `PublHolder`, `PublHolder_Controller`, `Publication`, `CartWidget`, `Publication_Controller`, `PublicationWidget`, `QuarterHourlyTask`, `QueuedEmail`, `QueuedEmailDispatchTask`, `RangeField`, `RatePeriod`, `RatingDataObject`, `RatingExtension_Controller`, `ReadonlyField`, `Catalog`, `RealtyImportAdmin`, `RealtyImportAdmin_CollectionController`, `RealtyImportLog`, `RealtyImportLog_Item`, `RealtyXMLImportTask`, `RebuildStaticCacheTask`, `RecentComments`, `RecentFiles`, `RecentPages`, `RecipientExportField`, `Catalog_Controller`, `RecipientImportField`, `RecipientImportField_UploadForm`, `RedirectEntry`, `RedirectEntry_Admin`, `RedirectorPage`, `RedirectorPage_Controller`, `RegionRestriction`, `RegistrationPage`, `RegistrationPage_Controller`, `RelatedPageLink`, `CatalogAdmin`, `RemoveOrphanedPagesTask`, `ReportAdmin`, `ResetFormAction`, `RestfulServer`, `RestrictedTextField`, `RestrictionRegionCountryDropdownField`, `Room`, `Room_Controller`, `RoomCatalog`, `RoomCatalog_Controller`, `AdvancedSliderHomepageWidget_Item`, `CatalogAdmin_CollectionController`, `RoomOrder`, `RoomOrderPerson`, `RoomRate`, `RoomRate_PriceField`, `RoomService`, `RoomServiceAdmin`, `RoomServiceDropdownField`, `RoomServiceOrder`, `RootURLController`, `SapphireInfo`, `CatalogAdmin_RecordController`, `SapphireREPL`, `SapphireSoapServer`, `SberbankPayment`, `SberbankPayment_Handler`, `ScaffoldingComplexTableField_Popup`, `ScheduledTask`, `Search_Controller`, `SearchForm`, `SearchWidget`, `Security`, `CatalogFilter`, `SecurityAdmin`, `SelectionGroup`, `SeparateHomepageWidget`, `SeparateSidebarWidget`, `ServiceOrder`, `ShippingMethod`, `ShippingMethodAdmin`, `ShippingMethodAdmin_CollectionController`, `ShopCountry`, `ShowPoll`, `CatalogFilterSidebarWidget`, `SidebarWidget`, `SidebarWidgetArea`, `SideReport_BrokenFiles`, `SideReport_BrokenLinks`, `SideReport_BrokenRedirectorPages`, `SideReport_BrokenVirtualPages`, `SideReport_EmptyPages`, `SideReport_RecentlyEdited`, `SideReport_ToDo`, `SideReportWrapper`, `CatalogPrice`, `SimpleHTMLEditorField`, `SimpleImageField`, `SimpleImageField_Disabled`, `SimpleOrderData`, `SimpleOrderForm`, `SimpleOrderForm_Controller`, `SimpleOrderPage`, `SimpleOrderPage_Controller`, `SimpleOrderPage_SubmittedFormEmail`, `SimpleTinyMCEField`, `CatalogRubricsHomepageWidget`, `SimpleTreeDropdownField`, `SimpleWysiwygField`, `SiteConfig`, `SiteInfo`, `SiteMap_Controller`, `SiteTree`, `SiteTreeMaintenanceTask`, `SliderHomepageWidget`, `SliderHomepageWidget_Item`, `SOAPModelAccess`, `ChangePasswordForm`, `Socle`, `Socle_Controller`, `SocleSection`, `SocleSize`, `SocleSize_Controller`, `SocleSize_SocleSectionTextField`, `SpamProtectorField`, `SpecialCatalog`, `SpecialCatalog_Controller`, `SpecialCatalogHomepageWidget`, `CheckboxField`, `SpecialCatalogSidebarWidget`, `SS_Datetime`, `SS_ReportWrapper`, `StartCatalog`, `StartCatalog_Controller`, `StateDropdownField`, `StateProvinceDropdownField`, `StaticExporter`, `StealthFieldCaptcha`, `StringField`, `CheckboxField_Disabled`, `SubmittedFileField`, `SubmittedForm`, `SubmittedFormField`, `SubmittedFormReportField`, `SubpageListField`, `SubpageListField_Item`, `SubPageListField_ItemRequest`, `SubscribeForm`, `SubscribeForm_Controller`, `SubscribeWidget`, `CheckboxField_Readonly`, `SubsectionMenuWidget`, `Subsite`, `Subsite_Template`, `SubsiteAdmin`, `SubsiteAdmin_CollectionController`, `SubsiteAgnosticTableListField`, `SubsiteDomain`, `SubsiteDropdownField`, `SubsiteReportWrapper`, `SubsitesSelectorPage`, `Aggregate_Relationship`, `CheckboxSetField`, `SubsitesSelectorPage_Controller`, `SubsitesTreeDropdownField`, `SubsitesVirtualPage`, `SubsitesVirtualPage_Controller`, `Tab`, `TableField`, `TableField_Item`, `TableListField`, `TableListField_ItemRequest`, `TableShippingMethod`, `CheckoutPage`, `TableShippingRate`, `TabSet`, `TaskRunner`, `TestRunner`, `TestViewer`, `Text`, `TextAnonsWidget`, `TextAnonsWidget_Item`, `TextareaField`, `TextBlockHomepageWidget`, `CheckoutPage_Controller`, `TextBlockSidebarWidget`, `TextField`, `TextFieldWithEmptyFlag`, `TextLiteralField`, `Texture3D_File`, `ThumbnailStripField`, `Time`, `TimeField`, `TimeField_Readonly`, `ToggleCompositeField`, `ChequePayment`, `ToggleField`, `TreeDropdownField`, `TreeDropdownField_Readonly`, `TreeMultiselectField`, `TreeMultiselectField_Readonly`, `TreeSelectorField`, `UniqueRestrictedTextField`, `UniqueTextField`, `UnitellerPayment`, `UnitellerPayment_Handler`, `ChequePayment_Handler`, `UnmoderatedComments`, `Unsubscribe_Controller`, `Unsubscribe_MailingListForm`, `UnsubscribedList`, `UnsubscribeRecord`, `Upload`, `UserDefinedForm`, `UserDefinedForm_Controller`, `UserDefinedForm_EmailRecipient`, `UserDefinedForm_SubmittedFormEmail`, `CliController`, `Varchar`, `VAT`, `VAT_Admin`, `VersionedRestfulServer`, `VideoBankPage`, `VideoBankPage_Controller`, `VideoCategory`, `VideoEntry`, `VideoFile`, `VideoManager`, `CMSActionOptionsForm`, `VirtualPage`, `VirtualPage_Controller`, `VirtualProduct`, `VirtualProduct_Controller`, `VKNotificationQueue`, `VKNotificationQueueAdmin`, `WeatherSidebarWidget`, `WebylonNews`, `WebylonWidget`, `WebylonWidget_Item`, `CMSBatchActionHandler`, `WebylonWidgetArea`, `WeeklyTask`, `WeightTableShippingMethod`, `WeightTableShippingRate`, `Widget`, `Widget_Controller`, `Widget_TreeDropdownField`, `WidgetAdmin`, `WidgetArea`, `WidgetAreaEditor`, `CMSMain`, `YaMoneyPayment`, `YaMoneyPayment_Handler`, `YandexMapsHomepageWidget`, `YandexMapsWidget`, `Year`, `YearlyTask`, `YMLExporter`, `CodeViewer`, `AjaxUniqueTextField`, `CommentAdmin`, `CommentTableField`, `CommentTableField_Item`, `ComplexTableField`, `ComplexTableField_Item`, `ComplexTableField_ItemRequest`, `ComplexTableField_Popup`, `ComponentSet`, `CompositeField`, `ConfirmedPasswordField`, `Announcement`, `ConsultantWidget`, `ContactsBlockWidget`, `ContactsPage`, `ContactsPage_Controller`, `ContentController`, `Controller`, `CorrectBadFoldersTask`, `CostTableShippingMethod`, `CostTableShippingRate`, `CountryDropdownField`, `Announcement_Controller`, `CreditCardField`, `CsvBulkLoader`, `Currency`, `CurrencyField`, `CurrencyField_Disabled`, `CurrencyField_Readonly`, `CurrencyWidget`, `CustomMenuAdmin`, `CustomMenuHolder`, `CustomMenuItem`

Package: sapphire\view
Located at sapphire/core/ViewableData.php

## Methods summary

`public static string` | # `castingObjectCreator( string $fieldSchema )` Converts a field spec into an object creator. For example: "Int" becomes "new Int($fieldName);" and "Varchar(50)" becomes "new Varchar($fieldName, 50);". Converts a field spec into an object creator. For example: "Int" becomes "new Int($fieldName);" and "Varchar(50)" becomes "new Varchar($fieldName, 50);". #### Parameters $fieldSchema string $fieldSchema The field spec #### Returns `string` string
`public static array` | # `castingObjectCreatorPair( string $fieldSchema )` Convert a field schema (e.g. "Varchar(50)") into a casting object creator array that contains both a className and castingHelper constructor code. See `ViewableData::castingObjectCreator()` for more information about the constructor. Convert a field schema (e.g. "Varchar(50)") into a casting object creator array that contains both a className and castingHelper constructor code. See `ViewableData::castingObjectCreator()` for more information about the constructor. #### Parameters $fieldSchema string $fieldSchema #### Returns `array` array
`public boolean` | # `__isset( string $property )` Check if a field exists on this object or its failover. Check if a field exists on this object or its failover. #### Parameters $property string $property #### Returns `boolean` bool
`public mixed` | # `__get( string $property )` Get the value of a property/field on this object. This will check if a method called get{$property} exists, then check if a field is available using `ViewableData::getField()`, then fall back on a failover object. Get the value of a property/field on this object. This will check if a method called get{$property} exists, then check if a field is available using `ViewableData::getField()`, then fall back on a failover object. #### Parameters $property string $property #### Returns `mixed` mixed
`public` | # `__set( string $property, mixed $value )` Set a property/field on this object. This will check for the existence of a method called set{$property}, then use the `ViewableData::setField()` method. Set a property/field on this object. This will check for the existence of a method called set{$property}, then use the `ViewableData::setField()` method. #### Parameters $property string $property $value mixed $value
`public boolean` | # `hasField( string $field )` Check if a field exists on this object. This should be overloaded in child classes. Check if a field exists on this object. This should be overloaded in child classes. #### Parameters $field string $field #### Returns `boolean` bool
`public mixed` | # `getField( string $field )` Get the value of a field on this object. This should be overloaded in child classes. Get the value of a field on this object. This should be overloaded in child classes. #### Parameters $field string $field #### Returns `mixed` mixed
`public` | # `setField( string $field, mixed $value )` Set a field on this object. This should be overloaded in child classes. Set a field on this object. This should be overloaded in child classes. #### Parameters $field string $field $value mixed $value
`public` | # `defineMethods( )` Add methods from the `ViewableData::$failover` object, as well as wrapping any methods prefixed with an underscore into a `ViewableData::cachedCall()`. Add methods from the `ViewableData::$failover` object, as well as wrapping any methods prefixed with an underscore into a `ViewableData::cachedCall()`. #### Overrides `Object::defineMethods`
`public `ViewableData_Customised`` | # `customise( array|`ViewableData` $data )` Merge some arbitrary data in with this object. This method returns a `ViewableData_Customised` instance with references to both this and the new custom data. Merge some arbitrary data in with this object. This method returns a `ViewableData_Customised` instance with references to both this and the new custom data. Note that any fields you specify will take precedence over the fields on this object. #### Parameters $data array|ViewableData $data #### Returns ``ViewableData_Customised`` ViewableData_Customised
`public` | # `setCustomisedObj( `ViewableData` $object )` #### Parameters $object ViewableData $object
`public array` | # `castingHelperPair( string $field )` Get the class a field on this object would be casted to, as well as the casting helper for casting a field to an object (see `ViewableData::castingHelper()` for information on casting helpers). Get the class a field on this object would be casted to, as well as the casting helper for casting a field to an object (see `ViewableData::castingHelper()` for information on casting helpers). The returned array contains two keys: - className: the class the field would be casted to (e.g. "Varchar") - castingHelper: the casting helper for casting the field (e.g. "return new Varchar($fieldName)") #### Parameters $field string $field #### Returns `array` array
`public string` | # `castingHelper( string $field )` Return the "casting helper" (a piece of PHP code that when evaluated creates a casted value object) for a field on this object. Return the "casting helper" (a piece of PHP code that when evaluated creates a casted value object) for a field on this object. #### Parameters $field string $field #### Returns `string` string
`public string` | # `castingClass( string $field )` Get the class name a field on this object will be casted to Get the class name a field on this object will be casted to #### Parameters $field string $field #### Returns `string` string
`public string` | # `escapeTypeForField( string $field )` Return the string-format type for the given field. Return the string-format type for the given field. #### Parameters $field string $field #### Returns `string` 'xml'|'raw'
`public` | # `buildCastingCache( reference & $cache )` Save the casting cache for this object (including data from any failovers) into a variable Save the casting cache for this object (including data from any failovers) into a variable #### Parameters $cache reference $cache
`public string` | # `renderWith( string|array|`SSViewer` $template, array $customFields = null )` Render this object into the template, and get the result as a string. You can pass one of the following as the $template parameter: - a template name (e.g. Page) - an array of possible template names - the first valid one will be used - an SSViewer instance Render this object into the template, and get the result as a string. You can pass one of the following as the $template parameter: - a template name (e.g. Page) - an array of possible template names - the first valid one will be used - an SSViewer instance #### Parameters $template string|array|SSViewer $template the template to render into $customFields array $customFields fields to customise() the object with before rendering #### Returns `string` string
`public` | # `obj( string $fieldName, array $arguments = null, boolean $forceReturnedObject = true, string $cache = false, mixed $cacheName = null )` Get the value of a field on this object, automatically inserting the value into any available casting objects that have been specified. Get the value of a field on this object, automatically inserting the value into any available casting objects that have been specified. #### Parameters $fieldName string $fieldName $arguments array $arguments $forceReturnedObject bool $forceReturnedObject if TRUE, the value will ALWAYS be casted to an object before being returned, even if there is no explicit casting information $cache string $cacheName a custom cache name $cacheName
`public` | # `cachedCall( string $field, array $arguments = null, string $identifier = null )` A simple wrapper around `ViewableData::obj()` that automatically caches the result so it can be used again without re-running the method. A simple wrapper around `ViewableData::obj()` that automatically caches the result so it can be used again without re-running the method. #### Parameters $field string $field $arguments array $arguments $identifier string $identifier an optional custom cache identifier
`public boolean` | # `hasValue( string $field, array $arguments = null, boolean $cache = true )` Checks if a given method/field has a valid value. If the result is an object, this will return the result of the exists method, otherwise will check if the result is not just an empty paragraph tag. Checks if a given method/field has a valid value. If the result is an object, this will return the result of the exists method, otherwise will check if the result is not just an empty paragraph tag. #### Parameters $field string $field $arguments array $arguments $cache bool $cache #### Returns `boolean` bool
`public string` | # `XML_val( string $field, array $arguments = null, boolean $cache = false )` Get the string value of a field on this object that has been suitable escaped to be inserted directly into a template. Get the string value of a field on this object that has been suitable escaped to be inserted directly into a template. #### Parameters $field string $field $arguments array $arguments $cache bool $cache #### Returns `string` string
`public string` | # `RAW_val( string $field, array $arguments = null, boolean $cache = true )` Return the value of the field without any escaping being applied. Return the value of the field without any escaping being applied. #### Parameters $field string $field $arguments array $arguments $cache bool $cache #### Returns `string` string
`public string` | # `SQL_val( string $field, array $arguments = null, boolean $cache = true )` Return the value of a field in an SQL-safe format. Return the value of a field in an SQL-safe format. #### Parameters $field string $field $arguments array $arguments $cache bool $cache #### Returns `string` string
`public string` | # `JS_val( string $field, array $arguments = null, boolean $cache = true )` Return the value of a field in a JavaScript-save format. Return the value of a field in a JavaScript-save format. #### Parameters $field string $field $arguments array $arguments $cache bool $cache #### Returns `string` string
`public string` | # `ATT_val( string $field, array $arguments = null, boolean $cache = true )` Return the value of a field escaped suitable to be inserted into an XML node attribute. Return the value of a field escaped suitable to be inserted into an XML node attribute. #### Parameters $field string $field $arguments array $arguments $cache bool $cache #### Returns `string` string
`public array` | # `getXMLValues( array $fields )` Get an array of XML-escaped values by field name Get an array of XML-escaped values by field name #### Parameters $fields array $elements an array of field names #### Returns `array` array
`public `ArrayIterator`` | # `getIterator( )` Return a single-item iterator so you can iterate over the fields of a single record. Return a single-item iterator so you can iterate over the fields of a single record. This is useful so you can use a single record inside a <% control %> block in a template - and then use to access individual fields on this object. #### Returns ``ArrayIterator`` ArrayIterator #### Implementation of `IteratorAggregate::getIterator()`
`public` | # `iteratorProperties( integer $pos, integer $totalItems )` Set the current iterator properties - where we are on the iterator. Set the current iterator properties - where we are on the iterator. #### Parameters $pos int $pos position in iterator $totalItems int $totalItems total number of items
`public boolean` | # `First( )` Returns true if this object is the first in a set. Returns true if this object is the first in a set. #### Returns `boolean` bool
`public boolean` | # `Last( )` Returns true if this object is the last in a set. Returns true if this object is the last in a set. #### Returns `boolean` bool
`public string|null` | # `FirstLast( )` Returns 'first' or 'last' if this is the first or last object in the set. Returns 'first' or 'last' if this is the first or last object in the set. #### Returns `string|null` string|null
`public boolean` | # `Middle( )` Return true if this object is between the first & last objects. Return true if this object is between the first & last objects. #### Returns `boolean` bool
`public string|null` | # `MiddleString( )` Return 'middle' if this object is between the first & last objects. Return 'middle' if this object is between the first & last objects. #### Returns `string|null` string|null
`public boolean` | # `Even( )` Return true if this object is an even item in the set. Return true if this object is an even item in the set. #### Returns `boolean` bool
`public boolean` | # `Odd( )` Return true if this is an odd item in the set. Return true if this is an odd item in the set. #### Returns `boolean` bool
`public string` | # `EvenOdd( )` Return 'even' or 'odd' if this object is in an even or odd position in the set respectively. Return 'even' or 'odd' if this object is in an even or odd position in the set respectively. #### Returns `string` string
`public integer` | # `Pos( integer $startIndex = 1 )` Return the numerical position of this object in the container set. The count starts at $startIndex. Return the numerical position of this object in the container set. The count starts at $startIndex. #### Parameters $startIndex int $startIndex Number to start count from. #### Returns `integer` int
`public integer` | # `TotalItems( )` Return the total number of "sibling" items in the dataset. Return the total number of "sibling" items in the dataset. #### Returns `integer` int
`public integer` | # `Modulus( integer $mod, integer $startIndex = 1 )` Returns the modulus of the numerical position of the item in the data set. The count starts from $startIndex, which defaults to 1. Returns the modulus of the numerical position of the item in the data set. The count starts from $startIndex, which defaults to 1. #### Parameters $mod int $Mod The number to perform Mod operation to. $startIndex int $startIndex Number to start count from. #### Returns `integer` int
`public` | # `MultipleOf( mixed $factor, mixed $offset = 1 )`
`public `ViewableData`` | # `Me( )` When rendering some objects it is necessary to iterate over the object being rendered, to do this, you need access to itself. When rendering some objects it is necessary to iterate over the object being rendered, to do this, you need access to itself. #### Returns ``ViewableData`` ViewableData
`public string` | # `ThemeDir( string $subtheme = false )` Return the directory if the current active theme (relative to the site root). Return the directory if the current active theme (relative to the site root). This method is useful for things such as accessing theme images from your template without hardcoding the theme page - e.g. <img src="$ThemeDir/images/something.gif">. This method should only be used when a theme is currently active. However, it will fall over to the current project directory. #### Parameters $subtheme string $subtheme the subtheme path to get #### Returns `string` string
`public string` | # `ThemeName( )` Возвращает имя текущей темы Возвращает имя текущей темы Если текущая тема не выбрана то возвращается site #### Returns `string` string
`public string` | # `CSSClasses( string $stopAtClass = 'ViewableData' )` Get part of the current classes ancestry to be used as a CSS class. Get part of the current classes ancestry to be used as a CSS class. This method returns an escaped string of CSS classes representing the current classes ancestry until it hits a stop point - e.g. "Page DataObject ViewableData". #### Parameters $stopAtClass string $stopAtClass the class to stop at (default: ViewableData) #### Returns `string` string #### Uses ``ClassInfo``
`public` | # `CurrentMember( )` #### See ``Member::currentUser()``
`public string` | # `getSecurityID( )` Return a CSRF-preventing ID to insert into a form. Return a CSRF-preventing ID to insert into a form. #### Returns `string` string
`public` | # `HasPerm( mixed $code )` #### See ``Permission::check()``
`public` | # `BaseHref( )` #### See ``Director::absoluteBaseURL()``
`public` | # `IsAjax( )` #### See ``Director::is_ajax()``
`public` | # `i18nLocale( )` #### See ``i18n::get_locale()``
`public `ViewableData_Debugger`` | # `Debug( )` Return debug information about this object that can be rendered into a template Return debug information about this object that can be rendered into a template #### Returns ``ViewableData_Debugger`` ViewableData_Debugger
`public` | # `CurrentPage( )` #### See ``Controller::curr()``
`public` | # `Top( )` #### See ``SSViewer::topLevel()``
`public` | # `ColumnCalc( mixed $col )`
`public` | # `ColumnNumber( mixed $col )`
`public` | # `ColumnPos( mixed $col )`
`public` | # `ColumnBreak( mixed $col )`
`public` | # `ColumnPad( mixed $col )`

### Methods inherited from Object

`__call()`, `__construct()`, `__toString()`, `__wakeup()`, `addMethodsFrom()`, `addStaticVars()`, `addWrapperMethod()`, `add_extension()`, `add_static_var()`, `allMethodNames()`, `cacheToFile()`, `cacheToFileWithArgs()`, `clearCache()`, `combined_static()`, `create()`, `createMethod()`, `create_from_string()`, `exists()`, `extInstance()`, `extend()`, `getCustomClass()`, `getExtensionInstance()`, `getExtensionInstances()`, `get_extensions()`, `get_static()`, `hasExtension()`, `hasMethod()`, `has_extension()`, `invokeWithExtensions()`, `is_a()`, `loadCache()`, `parentClass()`, `parse_class_spec()`, `remove_extension()`, `sanitiseCachename()`, `saveCache()`, `set_stat()`, `set_static()`, `set_uninherited()`, `stat()`, `strong_create()`, `uninherited()`, `uninherited_static()`, `useCustomClass()`

### Magic methods summary

## Properties summary

`public static array` | $casting | # An array of objects to cast certain fields to. This is set up as an array in the format: An array of objects to cast certain fields to. This is set up as an array in the format:
    public static $casting = array (
        'FieldName' => 'ClassToCastTo(Arguments)'
    );
`public static string` | $default_cast | # The default object to cast scalar fields to if casting information is not specified, and casting to an object is required. The default object to cast scalar fields to if casting information is not specified, and casting to an object is required.
`protected integer` | $iteratorPos | #
`protected mixed` | $iteratorTotalItems | #
`protected `ViewableData`` | $failover | # A failover object to attempt to get data from if it is not present on this object. A failover object to attempt to get data from if it is not present on this object.
`protected `ViewableData`` | $customisedObject | #

### Properties inherited from Object

`$class`, `$extension_instances`, `$extensions`

[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. -