NewRecordController

class \TYPO3\CMS\Backend\Controller\NewRecordController

Script class for 'db_new' and 'db_new_pages'

Attributes

#[AsController]

Table of Contents

Properties

$id  : int
$allowedNewTables  : array
$deniedNewTables  : array
$eventDispatcher  : EventDispatcherInterface
$iconFactory  : IconFactory
$moduleTemplateFactory  : ModuleTemplateFactory
$newContentInto  : bool
$newPagesAfter  : bool
$newPagesInto  : bool
$newPagesSelectPosition  : bool
Determines, whether "Select Position" for new page should be shown
$newRecordSortList  : array
$pageinfo  : array
$pageRenderer  : PageRenderer
$perms_clause  : string
$pidInfo  : array
$recordFactory  : RecordFactory
$request  : ServerRequestInterface
$resourceFactory  : SystemResourceFactory
$resourcePublisher  : SystemResourcePublisherInterface
$returnUrl  : string
$tcaSchemaFactory  : TcaSchemaFactory
$tRows  : array
$uriBuilder  : UriBuilder
$view  : ModuleTemplate

Methods

__construct()  : mixed
mainAction()  : ResponseInterface
Injects the request object for the current request or subrequest As this controller goes only through the main() method, it is rather simple for now
newPageAction()  : ResponseInterface
Pages only wizard
doPageRecordsExistInSystem()  : bool
getAllowedTables()  : array<int, string>
getBackendUserAuthentication()  : BackendUserAuthentication
getButtons()  : void
Create the panel of buttons for submitting the form or otherwise perform operations.
getLanguageService()  : LanguageService
getNewRecordControls()  : array
Render controls for creating a regular new element (pages or records)
getRecordTypesForDirectCreation()  : array
hasRecordTypesForDirectCreation()  : bool
init()  : void
Constructor function for the class
isRecordCreationAllowedForTable()  : bool
Returns whether the record link should be shown for a table
isTableAllowedOnPage()  : bool
Returns TRUE if the tablename $checkTable is allowed to be created on the page with record $pid_row
renderLink()  : string
Links the string $code to a create-new form for a record in $table created on page $pid
renderPageSelectPositionLink()  : string
Generate link to the page position selection "view"
sortTableRows()  : int
User array sort function used by renderNewRecordControls

Properties

$allowedNewTables

protected array $allowedNewTables = []

$deniedNewTables

protected array $deniedNewTables = []

$eventDispatcher read-only

protected EventDispatcherInterface $eventDispatcher

$newContentInto

protected bool $newContentInto = false

$newPagesAfter

protected bool $newPagesAfter = false

$newPagesInto

protected bool $newPagesInto = false

$newPagesSelectPosition

Determines, whether "Select Position" for new page should be shown

protected bool $newPagesSelectPosition = true

$newRecordSortList

protected array $newRecordSortList = []

$perms_clause

protected string $perms_clause = ''

$request

protected ServerRequestInterface $request

$returnUrl

protected string $returnUrl = ''

Methods

__construct()

public __construct(ComponentFactory $componentFactory, IconFactory $iconFactory, PageRenderer $pageRenderer, UriBuilder $uriBuilder, RecordFactory $recordFactory, ModuleTemplateFactory $moduleTemplateFactory, TcaSchemaFactory $tcaSchemaFactory, EventDispatcherInterface $eventDispatcher, SystemResourceFactory $resourceFactory, SystemResourcePublisherInterface $resourcePublisher, SchemaLabelResolver $schemaLabelResolver, TranslationDomainResolver $translationDomainResolver) : mixed

Parameters

$componentFactory : ComponentFactory
$iconFactory : IconFactory
$pageRenderer : PageRenderer
$uriBuilder : UriBuilder
$recordFactory : RecordFactory
$moduleTemplateFactory : ModuleTemplateFactory
$tcaSchemaFactory : TcaSchemaFactory
$eventDispatcher : EventDispatcherInterface
$resourceFactory : SystemResourceFactory
$resourcePublisher : SystemResourcePublisherInterface
$schemaLabelResolver : SchemaLabelResolver
$translationDomainResolver : TranslationDomainResolver

mainAction()

Injects the request object for the current request or subrequest As this controller goes only through the main() method, it is rather simple for now

public mainAction(ServerRequestInterface $request) : ResponseInterface

Parameters

$request : ServerRequestInterface

Return values

ResponseInterface

newPageAction()

Pages only wizard

public newPageAction(ServerRequestInterface $request) : ResponseInterface

Parameters

$request : ServerRequestInterface

Return values

ResponseInterface

doPageRecordsExistInSystem()

protected doPageRecordsExistInSystem() : bool

Return values

bool

getAllowedTables()

protected getAllowedTables() : array<int, string>

Return values

array<int, string>

getButtons()

Create the panel of buttons for submitting the form or otherwise perform operations.

protected getButtons() : void

getRecordTypesForDirectCreation()

protected getRecordTypesForDirectCreation(TcaSchema $schema, int $positionId) : array

Parameters

$schema : TcaSchema
$positionId : int

Return values

array

hasRecordTypesForDirectCreation()

protected hasRecordTypesForDirectCreation(TcaSchema $schema) : bool

Parameters

$schema : TcaSchema

Return values

bool

init()

Constructor function for the class

protected init(ServerRequestInterface $request) : void

Parameters

$request : ServerRequestInterface

isRecordCreationAllowedForTable()

Returns whether the record link should be shown for a table

protected isRecordCreationAllowedForTable(string $table[, array $allowedNewTables = [] ][, array $deniedNewTables = [] ]) : bool

Returns TRUE if:

  • $allowedNewTables and $deniedNewTables are empty
  • the table is not found in $deniedNewTables and $allowedNewTables is not set or the $table tablename is found in $allowedNewTables

If $table tablename is found in $allowedNewTables and $deniedNewTables, $deniedNewTables has priority over $allowedNewTables.

Parameters

$table : string

Table name to test if in allowedTables

$allowedNewTables : array = []

Array of new tables that are allowed.

$deniedNewTables : array = []

Array of new tables that are not allowed.

Return values

bool —

Returns TRUE if a link for creating new records should be displayed for $table

isTableAllowedOnPage()

Returns TRUE if the tablename $checkTable is allowed to be created on the page with record $pid_row

protected isTableAllowedOnPage(TcaSchema $schema, array $page) : bool

Parameters

$schema : TcaSchema

Table schema

$page : array

Potential parent page

Return values

bool —

Returns TRUE if the tablename $table is allowed to be created on the $page

Links the string $code to a create-new form for a record in $table created on page $pid

protected renderLink(string $table, int $pid[, array $additionalParams = [] ]) : string

Parameters

$table : string

Table name (in which to create new record)

$pid : int

PID value for the "&edit['.$table.']['.$pid.']=new" command (positive/negative)

$additionalParams : array = []

Additional params, such as "defVals" tp be added to the link

Return values

string —

The link.

Generate link to the page position selection "view"

protected renderPageSelectPositionLink() : string

Return values

string

sortTableRows()

User array sort function used by renderNewRecordControls

protected sortTableRows(string $a, string $b) : int

Parameters

$a : string

First array element for compare

$b : string

First array element for compare

Return values

int —

-1 for lower, 0 for equal, 1 for greater

On this page