[TYPO3-mvc] FAL Translation failed in View

Benjamin Giesbrecht beni.giesbrecht at gmail.com
Wed Sep 18 15:52:32 CEST 2013


Hy Together,

General: 
I'm using FAL to show an image Gallery in the Frontend. I have a "collection" Object with two actions, List and Show. 
A collection contains n file references and a titel. That works beautiful, except the translation handling. In the backend i can create 
a new data record in default language. After i create a new data record in an other language, as well i link it to the data record with the 
default language. Both contains some images with metafield like "title", "alt"... Those are all translatet. 

Now the Problem: 
My List View works great, the title is translatet as well. But my Show view doesn't work in other languages. It shows all the pictures of the default language. Also the meta fields comes in default language. I tried to fix it over a day, now i'm at the end of my mind.

Somebody know this problem?

Settings:

MODEL
-----------
class Collection extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {

	/**
	 * Title of the collection
	 *
	 * @var \string
	 * @validate NotEmpty
	 */
	protected $title;

	/**
	 * a collection have got n images
	 *
	 * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
	 */
	protected $images;

	/**
	 * __construct
	 *
	 * @return Collection
	 */
	public function __construct() {
		//Do not remove the next line: It would break the functionality
		$this->initStorageObjects();
	}

	/**
	 * Initializes all ObjectStorage properties.
	 *
	 * @return void
	 */
	protected function initStorageObjects() {
		/**
		 * Do not modify this method!
		 * It will be rewritten on each save in the extension builder
		 * You may modify the constructor of this class instead
		 */
		$this->images = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
	}

	/**
	 * Returns the title
	 *
	 * @return \string $title
	 */
	public function getTitle() {
		return $this->title;
	}

	/**
	 * Sets the title
	 *
	 * @param \string $title
	 * @return void
	 */
	public function setTitle($title) {
		$this->title = $title;
	}

	/**
	 * Returns the images
	 *
	 * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> $images
	 */
	public function getImages() {
		return $this->images;
	}

	/**
	 * Sets the images
	 *
	 * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference> $images
         * @return void
	 */
	public function setImages($images) {
		$this->images = $images;
	}
}


CONTROLLER
---------------------

class CollectionController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController {

	/**
	 * collectionRepository
	 *
	 * @var \BFA\ShGallery\Domain\Repository\CollectionRepository
	 * @inject
	 */
	protected $collectionRepository;

	/**
	 * action list
	 *
	 * @return void
	 */
	public function listAction() {
		$collections = $this->collectionRepository->findAll();
		$this->view->assign('collections', $collections);
	}

	/**
	 * action show
	 *
	 * @param \BFA\ShGallery\Domain\Model\Collection $collection
	 * @return void
	 */
	public function showAction(\BFA\ShGallery\Domain\Model\Collection $collection) {
		$this->view->assign('collection', $collection);
	}

}

TCA
-------

'title' => array(
			'exclude' => 0,
			'label' => 'LLL:EXT:sh_gallery/Resources/Private/Language/locallang_db.xlf:tx_shgallery_domain_model_collection.title',
			'config' => array(
				'type' => 'input',
				'size' => 30,
				'eval' => 'trim,required'
			),
		),
		'images' => array(
            'exclude' => 0,
            'label' => 'LLL:EXT:sh_gallery/Resources/Private/Language/locallang_db.xlf:tx_shgallery_domain_model_collection.images',
            'config' => array(
                'maxitems' => 999,
                'type' => 'inline',
                'foreign_table' => 'sys_file_reference',
                'foreign_field' => 'uid_foreign',
                'foreign_sortby' => 'sorting_foreign',
                'foreign_table_field' => 'tablenames',
                'foreign_match_fields' => array(
                    'fieldname' => 'images'
                ),
                'foreign_label' => 'uid_local',
                'foreign_selector' => 'uid_local',
                'foreign_selector_fieldTcaOverride' => array(
                    'config' => array(
                        'appearance' => array(
                            'elementBrowserType' => 'file',
                            'elementBrowserAllowed' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
                        )
                    )
                ),
                'appearance' => array(
                    'createNewRelationLinkTitle' => 'LLL:EXT:cms/locallang_ttc.xlf:images.addFileReference',
                    'useSortable' => TRUE,
                    'collapseAll' => 1,
                    'expandSingle' => 1,
                    'headerThumbnail' => array(
                        'field' => 'uid_local',
                        'width' => '64',
                        'height' => '64',
                    ),
                    'showPossibleLocalizationRecords' => TRUE,
                    'showRemovedLocalizationRecords' => TRUE,
                    'showSynchronizationLink' => TRUE,
                    'enabledControls' => array(
                        'info' => FALSE,
                        'new' => FALSE,
                        'dragdrop' => TRUE,
                        'sort' => FALSE,
                        'hide' => TRUE,
                        'delete' => TRUE,
                        'localize' => TRUE,
                    ),
                ),
                'behaviour' => array(
                    'localizationMode' => 'select',
                    'localizeChildrenAtParentLocalization' => TRUE,
                ),
            ),
        ),




More information about the TYPO3-project-typo3v4mvc mailing list