[TYPO3-dev] Workspaces, languages, where, enableFields...

Ernesto Baschny [cron IT] ernst at cron-it.de
Thu Jul 3 10:41:13 CEST 2008


Sonja Scholz wrote: on 03.07.2008 10:08:

> We would like to select records from a table with certain criterias. The 
> records should be translated by language overlay and the workspace 
> preview should also be considered. Additionally of course the 
> enableFields should be taken care of.
> 
> We could not find any satisfying solution. Language and enableFields is 
> easy, but the whole workspace thing is nearly impossible to do it the 
> right way.
> 
> There should be really ONE simple snippet/example which includes 
> everything which should be considered.
> 
> There are nearly no extensions which do workspace preview, because it is 
> so hard to implement.
> 
> It would also be nice to have a general function for doing that:
> http://bugs.typo3.org/view.php?id=8889
> 
> It would be also great if one could JOIN multiple tables and still the 
> workspace would be recognized. Imagine you have some records which have 
> a (real) MM relation to another table (categories) and you want to 
> select all records which are in category B, but translated and workspace 
> preview...
> 
> If you want to have extension developer implementing workspace, it has 
> to be as easy as possible :-)
> 
> Does anybody have a usable example?

Well, versionOL() should be all you need for workspace support if you 
are selecting records based on an uid (single-view) or a pid:

   $row = get your records as you do, using ->enableFields
   ...
   $GLOBALS['TSFE']->sys_page->versionOL($table, $row);
   $GLOBALS['TSFE']->sys_page->fixVersioningPid($table,$row);
   if ($GLOBALS['TSFE']->sys_language_content > 0) {
     $row = $GLOBALS['TSFE']->sys_page->getRecordOverlay(
         $table,
         $row,
         $GLOBALS['TSFE']->sys_language_content,
         $GLOBALS['TSFE']->sys_language_contentOL
     );
   }

I found it important to do the versionOL before doing the recordOverlay 
for translations.

Ok, more complex stuff might be required in special cases. Also take a 
look at tt_news, because it probably contains all stuff needed for 
workspaces, although it is a bit confusing to find.

About the "join" problem, yea, that will probably need more "brain 
activity" than I can handle at the moment. :)

Cheers,
Ernesto




More information about the TYPO3-dev mailing list