Reputation: 1344
I have an extension called calendar
and it contains a record event
. For an event to be displayed on the Front End it has be approved by the admin. But once the admin has approved/rejected it, the record should no longer be editable from the backend.
I want to do something like this :
TcaEvent.php
if ($currentRecord_Permission=='Accept' or $currentRecord_Permission=='Reject')
# Make the current record non-editable
else #make the current record editable
Will the $TCA
array contain the details of the current record being edited? If so, I can use it to achieve the above mentioned.
Upvotes: 0
Views: 674
Reputation: 1488
Try to use 'editlock'. This is exactly what you need.
Field name, which – if set – will prevent all editing of the record for non-admin users.The field should be configured as a checkbox type. Non-admins could be allowed to edit the checkbox but if they set it, they will effectively lock the record so they cannot edit it again – and they need an Admin-user to remove the lock.Note that this flag is cleared when a new copy or version of the record is created.This feature is used on the pages table, where it also prevents editing of records on that page (except other pages)! Also, no new records (including pages) can be created on the page.
So all you have to do is to set this field to TRUE after admin will approve the record. Or even admin can set that field if the approve means he enter to edit the BE record anyway.
Read more here: http://typo3.org/documentation/document-library/core-documentation/doc_core_tca/4.7.1/view/1/3/
Find 'editlock'.
Basically you have to define in your TCA waht field in table will be an editlock field like this:
$TCA['tx_address_domain_model_item'] = array(
'ctrl' => array(
'title' => 'Title'
'editlock' => 'editlock',
...
Upvotes: 2
Reputation: 2761
The $TCA
is a configuration array and does not contain any data of any records. It just holds the configuration of all fields that TYPO3 uses. There is also not a field which prevents a record from beeing edited except an admin. To achive this, you can create a second page which holds approved records and make this page invisible for non admin users via the permission module. Just set the owner of the page to user admin and group admin.
Upvotes: 0