Version: current

# Class ModelAdmin_CollectionController

Handles a managed model class and provides default collection filtering behavior.

  Object
  ViewableData implements IteratorAggregate
  RequestHandler
  Controller
  ModelAdmin_CollectionController

### Direct known subclasses

`BookingOrderAdmin_CollectionController`, `CatalogAdmin_CollectionController`, `SubsiteAdmin_CollectionController`, `GuestbookAdmin_CollectionController`, `LoggerAdmin_CollectionController`, `OrderAdmin_CollectionController`, `PaymentAdmin_CollectionController`, `ProductImport1CAdmin_CollectionController`, `ProductImportAdmin_CollectionController`, `RealtyImportAdmin_CollectionController`, `ShippingMethodAdmin_CollectionController`

Package: cms\core
Located at cms/code/ModelAdmin.php

## Methods summary

`public` | # `__construct( mixed $parent, mixed $model )` #### Overrides `RequestHandler::__construct`
`public string` | # `Link( string $action = null )` Appends the model class to the URL. Appends the model class to the URL. #### Parameters $action string $action #### Returns `string` string
`public unknown` | # `getModelClass( )` Return the class name of the model being managed. Return the class name of the model being managed. #### Returns `unknown` unknown
`public unknown` | # `handleActionOrID( unknown_type $request )` Delegate to different control flow, depending on whether the URL parameter is a number (record id) or string (action). Delegate to different control flow, depending on whether the URL parameter is a number (record id) or string (action). #### Parameters $request unknown_type $request #### Returns `unknown` unknown
`public RecordController` | # `handleID( `SS_HTTPRequest` $request )` Delegate to the RecordController if a valid numeric ID appears in the URL segment. Delegate to the RecordController if a valid numeric ID appears in the URL segment. #### Parameters $request SS_HTTPRequest $request #### Returns `RecordController` RecordController
`public string` | # `getModelSidebar( )` Get a combination of the Search, Import and Create forms that can be inserted into a `ModelAdmin` sidebar. Get a combination of the Search, Import and Create forms that can be inserted into a `ModelAdmin` sidebar. #### Returns `string` string
`public `Form`` | # `SearchForm( )` Get a search form for a single `DataObject` subclass. Get a search form for a single `DataObject` subclass. #### Returns ``Form`` Form
`public` | # `CreateForm( )` Create a form that consists of one button that directs to a give model's Add form Create a form that consists of one button that directs to a give model's Add form
`public `Form`` | # `ImportForm( )` Generate a CSV import form for a single `DataObject` subclass. Generate a CSV import form for a single `DataObject` subclass. #### Returns ``Form`` Form
`public` | # `import( array $data, `Form` $form, `SS_HTTPRequest` $request )` Imports the submitted CSV file based on specifications given in self::model_importers. Redirects back with a success/failure message. Imports the submitted CSV file based on specifications given in self::model_importers. Redirects back with a success/failure message. #### Parameters $data array $data $form Form $form $request SS_HTTPRequest $request
`public` | # `columnsAvailable( )` Return the columns available in the column selection field. Overload this to make other columns available Return the columns available in the column selection field. Overload this to make other columns available
`public` | # `columnsSelectedByDefault( )` Return the columns selected by default in the column selection field. Overload this to make other columns selected by default Return the columns selected by default in the column selection field. Overload this to make other columns selected by default
`public` | # `ColumnSelectionField( )` Give the flexibilility to show variouse combination of columns in the search result table Give the flexibilility to show variouse combination of columns in the search result table
`public string` | # `search( mixed $request, mixed $form )` Action to render a data object collection, using the model context to provide filters and paging. Action to render a data object collection, using the model context to provide filters and paging. #### Returns `string` string
`public `SQLQuery`` | # `getSearchQuery( mixed $searchCriteria )` Gets the search query generated on the SearchContext from `DataObject::getDefaultSearchContext()`, and the current GET parameters on the request. Gets the search query generated on the SearchContext from `DataObject::getDefaultSearchContext()`, and the current GET parameters on the request. #### Returns ``SQLQuery`` SQLQuery
`public` | # `getResultColumns( array $searchCriteria, boolean $selectedOnly = true )` Returns all columns used for tabular search results display. Defaults to all fields specified in DataObject->summaryFields(). Returns all columns used for tabular search results display. Defaults to all fields specified in DataObject->summaryFields(). #### Parameters $searchCriteria array $searchCriteria Limit fields by populating the 'ResultsAssembly' key $selectedOnly boolean $selectedOnly Limit by 'ResultsAssempty
`public `TableListField`` | # `getResultsTable( array $searchCriteria )` Creates and returns the result table field for resultsForm. Uses resultsTableClassName() to initialise the formfield. Method is called from `ModelAdmin_CollectionController::ResultsForm()`. Creates and returns the result table field for resultsForm. Uses resultsTableClassName() to initialise the formfield. Method is called from `ModelAdmin_CollectionController::ResultsForm()`. #### Parameters $searchCriteria array $searchCriteria passed through from ResultsForm #### Returns ``TableListField`` TableListField #### Used by ``ModelAdmin_CollectionController::ResultsForm()``
`public `Form`` | # `ResultsForm( mixed $searchCriteria )` Shows results from the "search" action in a TableListField. Shows results from the "search" action in a TableListField. #### Returns ``Form`` Form #### Uses ``ModelAdmin_CollectionController::getResultsTable()``
`public unknown` | # `add( unknown_type $request )` Create a new model record. Create a new model record. #### Parameters $request unknown_type $request #### Returns `unknown` unknown
`public `Form`` | # `AddForm( )` Returns a form suitable for adding a new model, falling back on the default edit form. Returns a form suitable for adding a new model, falling back on the default edit form. Caution: The add-form shows a DataObject's DataObject->getCMSFields() method on a record that doesn't exist in the database yet, hence has no ID. This means the DataObject->getCMSFields() implementation has to ensure that no fields are added which would rely on a record ID being present, e.g. `HasManyComplexTableField`. Example:
    function getCMSFields() {
      $fields = parent::getCMSFields();
        if($this->exists()) {
          $ctf = new HasManyComplexTableField($this, 'MyRelations', 'MyRelation');
          $fields->addFieldToTab('Root.Main', $ctf);
        }
      return $fields;
    }
#### Returns ``Form`` Form
`public` | # `doCreate( mixed $data, mixed $form, mixed $request )`

### Methods inherited from Controller

`CurrentMember()`, `Now()`, `PastMember()`, `PastVisitor()`, `can()`, `curr()`, `defaultAction()`, `disableBasicAuth()`, `getAction()`, `getFormOwner()`, `getRequest()`, `getResponse()`, `getSession()`, `getURLParams()`, `getViewer()`, `handleAction()`, `handleRequest()`, `hasAction()`, `hasActionTemplate()`, `has_curr()`, `init()`, `isAjax()`, `join_links()`, `popCurrent()`, `pushCurrent()`, `redirect()`, `redirectBack()`, `redirectedTo()`, `render()`, `setSession()`, `setURLParams()`

### Methods inherited from RequestHandler

`allowedActions()`, `checkAccessAction()`, `httpError()`

### Methods inherited from ViewableData

`ATT_val()`, `BaseHref()`, `CSSClasses()`, `ColumnBreak()`, `ColumnCalc()`, `ColumnNumber()`, `ColumnPad()`, `ColumnPos()`, `CurrentPage()`, `Debug()`, `Even()`, `EvenOdd()`, `First()`, `FirstLast()`, `HasPerm()`, `IsAjax()`, `JS_val()`, `Last()`, `Me()`, `Middle()`, `MiddleString()`, `Modulus()`, `MultipleOf()`, `Odd()`, `Pos()`, `RAW_val()`, `SQL_val()`, `ThemeDir()`, `ThemeName()`, `Top()`, `TotalItems()`, `XML_val()`, `__get()`, `__isset()`, `__set()`, `buildCastingCache()`, `cachedCall()`, `castingClass()`, `castingHelper()`, `castingHelperPair()`, `castingObjectCreator()`, `castingObjectCreatorPair()`, `customise()`, `defineMethods()`, `escapeTypeForField()`, `getField()`, `getIterator()`, `getSecurityID()`, `getXMLValues()`, `hasField()`, `hasValue()`, `i18nLocale()`, `iteratorProperties()`, `obj()`, `renderWith()`, `setCustomisedObj()`, `setField()`

### Methods inherited from Object

`__call()`, `__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 mixed` | $parentController | #
`protected mixed` | $modelClass | #
`public static array` | $url_handlers | # Default URL handlers - (Action)/(ID)/(OtherID) Default URL handlers - (Action)/(ID)/(OtherID)

### Properties inherited from Controller

`$action`, `$allowed_actions`, `$baseInitCalled`, `$basicAuthEnabled`, `$controller_stack`, `$request`, `$requestParams`, `$response`, `$session`, `$urlParams`

### Properties inherited from RequestHandler

`$brokenOnConstruct`

### Properties inherited from ViewableData

`$casting`, `$customisedObject`, `$default_cast`, `$failover`, `$iteratorPos`, `$iteratorTotalItems`

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