[TYPO3-dev] TCA display field "readonly" based on condition

Richard Davies richard at ocular.co.nz
Sun Dec 21 21:36:34 CET 2014


Hi Satish,

The only documentation I know on hooks is this:
http://docs.typo3.org/typo3cms/CoreApiReference/ApiOverview/Hooks/Configuration/Index.html

In your case, you want to use the hook processDatamap_preProcessFieldArray.
You'll use it like so (where myext is your extension name etc):

Set up your hook in ext_localconf.php

> $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][]
> = 'EXT:myext/class.tx_myext_tcemain.php:&tx_myext_tcemain';
>
> Create your file class.tx_myext_tcemain.php with the following code in it:

 class tx_myext_tcemain {
>
> function processDatamap_preProcessFieldArray(&$incomingFieldArray, $table,
> $id, &$classRef){
>         if($table == 'tx_myext_domain_model_table'){           //the table
> request status is in
>             //YOUR CODE
>         }
>     }
>
}
>

In //YOUR CODE you can do something like

> if ($incomingFieldArray['request_status'] == 2)


>
$GLOBALS['TCA']['tx_myext_domain_model_table']['columns']['request_status']['config']['items']
> = array(array('Accepted',
> '2'))

else
>
 $GLOBALS['TCA']['tx_myext_domain_model_table']['columns']['request_status']['config']['items']
> = (the default item array)
>



Richard


On 19 December 2014 at 19:59, Satish Maurya <satish04mca at gmail.com> wrote:

> Hi All,
>
> Is there anyone have idea about this?
>
> Thanks
> Satish
>
> On Thu, Dec 18, 2014 at 3:51 PM, Satish Maurya <satish04mca at gmail.com>
> wrote:
> >
> > Thanks Philipp !!!
> > I did not get completely your word.
> > Do you know any documentation available for this?
> > Where and what code I have to write for this?
> >
> > Thanks
> > Satish
> >
> > On Thu, Dec 18, 2014 at 3:07 PM, Philipp Gampe <philipp.gampe at typo3.org>
> > wrote:
> > >
> > > Hi Satish,
> > >
> > > Satish Maurya wrote:
> > >
> > > > Can anyone have any idea about it.
> > >
> > > You can use hooks in datahandler (tce main) and the central form
> handling
> > > (tce form) to archive this.
> > >
> > > Best regards
> > > --
> > > Philipp Gampe - PGP-Key 0AD96065 - TYPO3 UG Bonn/Köln
> > > Documentation - Active contributor TYPO3 CMS
> > > TYPO3 .... inspiring people to share!
> > >
> > > _______________________________________________
> > > TYPO3-dev mailing list
> > > TYPO3-dev at lists.typo3.org
> > > http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-dev
> > >
> >
> >
> > --
> > *Thanks & regards,*
> > Satish Maurya
> > _______________________________________________
> > TYPO3-dev mailing list
> > TYPO3-dev at lists.typo3.org
> > http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-dev
> >
>
>
> --
> *Thanks & regards,*
> Satish Maurya
> _______________________________________________
> TYPO3-dev mailing list
> TYPO3-dev at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-dev
>



More information about the TYPO3-dev mailing list