TYPO3CMS  8
 All Classes Namespaces Files Functions Variables Pages
FrontendEditingController Class Reference

Public Member Functions

 initConfigOptions ()
 
 displayEditPanel ($content, array $conf, $currentRecord, array $dataArray)
 
 displayEditIcons ($content, $params, array $conf=[], $currentRecord= '', array $dataArray=[], $addUrlParamStr= '')
 
 isEditAction ()
 
 isEditFormShown ()
 
 editAction ()
 
 doHide ($table, $uid)
 
 doUnhide ($table, $uid)
 
 doUp ($table, $uid)
 
 doDown ($table, $uid)
 
 doMoveAfter ($table, $uid)
 
 doDelete ($table, $uid)
 
 doSave ($table, $uid)
 
 doSaveAndClose ($table, $uid)
 
 doClose ($table, $uid)
 
 getJavascriptIncludes ()
 
 getHiddenFields (array $dataArray)
 

Public Attributes

 $TSFE_EDIT
 

Protected Member Functions

 move ($table, $uid, $direction= '', $afterUID=0)
 
 allowedToEditLanguage ($table, array $currentRecord)
 
 allowedToEdit ($table, array $dataArray, array $conf, $checkEditAccessInternals=true)
 
 getAllowedEditActions ($table, array $conf, $pid, $allow= '')
 
 initializeTceMain ()
 

Protected Attributes

 $tce
 

Detailed Description

Controller class for frontend editing.

Definition at line 29 of file FrontendEditingController.php.

Member Function Documentation

allowedToEdit (   $table,
array  $dataArray,
array  $conf,
  $checkEditAccessInternals = true 
)
protected

Checks whether the user is allowed to edit the requested table.

Parameters
string$tableThe name of the table.
array$dataArrayThe data array.
array$confThe configuration array for the edit panel.
bool$checkEditAccessInternalsBoolean indicating whether recordEditAccessInternals should not be checked. Defaults
Returns
bool

Definition at line 529 of file FrontendEditingController.php.

References $GLOBALS, Permission\CONTENT_EDIT, FrontendEditingController\getAllowedEditActions(), and GeneralUtility\trimExplode().

Referenced by FrontendEditingController\displayEditIcons(), and FrontendEditingController\displayEditPanel().

allowedToEditLanguage (   $table,
array  $currentRecord 
)
protected

Checks whether the user has access to edit the language for the requested record.

Parameters
string$tableThe name of the table.
array$currentRecordThe record.
Returns
bool

Definition at line 500 of file FrontendEditingController.php.

References $GLOBALS.

Referenced by FrontendEditingController\displayEditIcons(), and FrontendEditingController\displayEditPanel().

displayEditIcons (   $content,
  $params,
array  $conf = [],
  $currentRecord = '',
array  $dataArray = [],
  $addUrlParamStr = '' 
)

Adds an edit icon to the content string. The edit icon links to FormEngine with proper parameters for editing the table/fields of the context. This implements TYPO3 context sensitive editing facilities. Only backend users will have access (if properly configured as well).

Parameters
string$contentThe content to which the edit icons should be appended
string$paramsThe parameters defining which table and fields to edit. Syntax is [tablename]:[fieldname],[fieldname],[fieldname],... OR [fieldname],[fieldname],[fieldname],... (basically "[tablename]:" is optional, default table is the one of the "current record" used in the function). The fieldlist is sent as "&columnsOnly=" parameter to FormEngine
array$confTypoScript properties for configuring the edit icons.
string$currentRecordThe "table:uid" of the record being shown. If empty string then $this->currentRecord is used. For new records (set by $conf['newRecordFromTable']) it's auto-generated to "[tablename]:NEW
array$dataArrayAlternative data array to use. Default is $this->data
string$addUrlParamStrAdditional URL parameters for the link pointing to FormEngine
Returns
string The input content string, possibly with edit icons added (not necessarily in the end but just after the last string of normal content.

Definition at line 122 of file FrontendEditingController.php.

References $GLOBALS, FrontendEditingController\allowedToEdit(), FrontendEditingController\allowedToEditLanguage(), GeneralUtility\getUserObj(), and GeneralUtility\trimExplode().

Referenced by FrontendEditingController\displayEditPanel().

displayEditPanel (   $content,
array  $conf,
  $currentRecord,
array  $dataArray 
)

Generates the "edit panels" which can be shown for a page or records on a page when the Admin Panel is enabled for a backend users surfing the frontend. With the "edit panel" the user will see buttons with links to editing, moving, hiding, deleting the element This function is used for the cObject EDITPANEL and the stdWrap property ".editPanel"

Parameters
string$contentA content string containing the content related to the edit panel. For cObject "EDITPANEL" this is empty but not so for the stdWrap property. The edit panel is appended to this string and returned.
array$confTypoScript configuration properties for the editPanel
string$currentRecordThe "table:uid" of the record being shown. If empty string then $this->currentRecord is used. For new records (set by $conf['newRecordFromTable']) it's auto-generated to "[tablename]:NEW
array$dataArrayAlternative data array to use. Default is $this->data
Returns
string The input content string with the editPanel appended. This function returns only an edit panel appended to the content string if a backend user is logged in (and has the correct permissions). Otherwise the content string is directly returned.

Definition at line 71 of file FrontendEditingController.php.

References $GLOBALS, FrontendEditingController\allowedToEdit(), FrontendEditingController\allowedToEditLanguage(), FrontendEditingController\displayEditIcons(), FrontendEditingController\getAllowedEditActions(), FrontendEditingController\getHiddenFields(), and GeneralUtility\getUserObj().

doClose (   $table,
  $uid 
)

Stub for closing a record. No real functionality needed since content element rendering will take care of everything.

Parameters
string$tableThe table name for the record to close.
int$uidThe UID for the record to close.
Returns
void

Definition at line 488 of file FrontendEditingController.php.

doDelete (   $table,
  $uid 
)

Deletes a specific record.

Parameters
string$tableThe table name for the record to delete.
int$uidThe UID for the record to delete.
Returns
void

Definition at line 434 of file FrontendEditingController.php.

References FrontendEditingController\initializeTceMain().

doDown (   $table,
  $uid 
)

Moves a record down.

Parameters
string$tableThe table name for the record to move.
int$uidThe UID for the record to move.
Returns
void

Definition at line 288 of file FrontendEditingController.php.

References FrontendEditingController\move().

doHide (   $table,
  $uid 
)

Hides a specific record.

Parameters
string$tableThe table name for the record to hide.
int$uidThe UID for the record to hide.
Returns
void

Definition at line 238 of file FrontendEditingController.php.

References $GLOBALS, and FrontendEditingController\initializeTceMain().

doMoveAfter (   $table,
  $uid 
)

Moves a record after a given element. Used for drag.

Parameters
string$tableThe table name for the record to move.
int$uidThe UID for the record to move.
Returns
void

Definition at line 300 of file FrontendEditingController.php.

References $GLOBALS, and FrontendEditingController\move().

doSave (   $table,
  $uid 
)

Saves a record based on its data array.

Parameters
string$tableThe table name for the record to save.
int$uidThe UID for the record to save.
Returns
void

Definition at line 451 of file FrontendEditingController.php.

References $GLOBALS, and FrontendEditingController\initializeTceMain().

Referenced by FrontendEditingController\doSaveAndClose().

doSaveAndClose (   $table,
  $uid 
)

Saves a record based on its data array and closes it.

Parameters
string$tableThe table name for the record to save.
int$uidThe UID for the record to save.
Returns
void
Note
This method is only a wrapper for doSave() but is needed so

Definition at line 475 of file FrontendEditingController.php.

References FrontendEditingController\doSave().

doUnhide (   $table,
  $uid 
)

Unhides (shows) a specific record.

Parameters
string$tableThe table name for the record to unhide.
int$uidThe UID for the record to unhide.
Returns
void

Definition at line 257 of file FrontendEditingController.php.

References $GLOBALS, and FrontendEditingController\initializeTceMain().

doUp (   $table,
  $uid 
)

Moves a record up.

Parameters
string$tableThe table name for the record to move.
int$uidThe UID for the record to hide.
Returns
void

Definition at line 276 of file FrontendEditingController.php.

References FrontendEditingController\move().

editAction ( )

Management of the on-page frontend editing forms and edit panels. Basically taking in the data and commands and passes them on to the proper classes as they should be.

Returns
void
Exceptions
UnexpectedValueException if TSFE_EDIT[cmd] is not a valid command
See also

Definition at line 203 of file FrontendEditingController.php.

References $GLOBALS, and GeneralUtility\callUserFunction().

Referenced by FrontendEditingController\initConfigOptions().

getAllowedEditActions (   $table,
array  $conf,
  $pid,
  $allow = '' 
)
protected

Takes an array of generally allowed actions and filters that list based on page and content permissions.

Parameters
string$tableThe name of the table.
array$confThe configuration array.
int$pidThe PID where editing will occur.
string$allowComma-separated list of actions that are allowed in general.
Returns
array

Definition at line 578 of file FrontendEditingController.php.

References $GLOBALS, Permission\PAGE_DELETE, Permission\PAGE_EDIT, Permission\PAGE_NEW, and GeneralUtility\trimExplode().

Referenced by FrontendEditingController\allowedToEdit(), and FrontendEditingController\displayEditPanel().

getHiddenFields ( array  $dataArray)

Gets the hidden fields (array key=field name, value=field value) to be used in the edit panel for a particular content element. In the normal case, no hidden fields are needed but special controllers such as TemplaVoila need to track flexform pointers, etc.

Parameters
array$dataArrayThe data array for a specific content element.
Returns
array

Definition at line 630 of file FrontendEditingController.php.

Referenced by FrontendEditingController\displayEditPanel().

getJavascriptIncludes ( )

Adds any extra Javascript includes needed for Front-end editing

Returns
string

Definition at line 617 of file FrontendEditingController.php.

initConfigOptions ( )

Initializes configuration options.

Returns
void

Definition at line 49 of file FrontendEditingController.php.

References $GLOBALS, GeneralUtility\_GP(), FrontendEditingController\editAction(), and FrontendEditingController\isEditAction().

initializeTceMain ( )
protected
isEditAction ( )

Returns TRUE if an edit-action is sent from the Admin Panel

Returns
bool
See also

Definition at line 162 of file FrontendEditingController.php.

Referenced by FrontendEditingController\initConfigOptions().

isEditFormShown ( )

Returns TRUE if an edit form is shown on the page. Used from RequestHandler where a TRUE return-value will result in classes etc. being included.

Returns
bool
See also

Definition at line 185 of file FrontendEditingController.php.

move (   $table,
  $uid,
  $direction = '',
  $afterUID = 0 
)
protected

Moves a record

Parameters
string$tableThe table name for the record to move.
int$uidThe UID for the record to move.
string$directionThe direction to move, either 'up' or 'down'.
int$afterUIDThe UID of record to move after. This is specified for dragging only.
Returns
void

Definition at line 315 of file FrontendEditingController.php.

References $fields, $GLOBALS, FrontendEditingController\initializeTceMain(), GeneralUtility\makeInstance(), and GeneralUtility\trimExplode().

Referenced by FrontendEditingController\doDown(), FrontendEditingController\doMoveAfter(), and FrontendEditingController\doUp().

Member Data Documentation

$tce
protected

Definition at line 42 of file FrontendEditingController.php.

$TSFE_EDIT

Definition at line 37 of file FrontendEditingController.php.