[TYPO3-mvc] Flexform switchableControllerActions per model

Franz Koch typo3.RemoveForMessage at elements-net.de
Wed Jan 20 11:30:41 CET 2010


Hey guys,

>> The entry for the dances is interesting as it enables more then one controller/action pair. The
>> problem is that whenever I add a new action to the controller all my plugins in tt_content will be
>> invalidated because the key has changed (eg to "Dance->index;Dance->show;Dance->new").
> Good point. Can this somehow be solved on the Flexform side? (e.g. by
> defining other keys?)

AFAIK not from Flexform side - a option element can only have a title 
and a value - and the values in this case are the action names. What 
might be a solution is to define something like configuration presets 
and you only switch the presets from within your Flexform.

--TS-config:----------------
plugin.yourExt {
	configurationPresets {
		blog {
			controller = Blog
			action = index
			switchableControllerActions {
				1 {
					controller = Blog
					actions = index,show
				}
				2 {
					controller = Posts
					actions = index,show
				}
			}
		}
	}
}

and in your Flexform you write:

<config>
	<type>select</type>
	<items>
		<numIndex index="0" type="array">
			<numIndex index="0">predefined configuration (TS)</numIndex>
			<numIndex index="1"></numIndex>
		</numIndex>
		<numIndex index="1" type="array">
			<numIndex index="0">Blogs</numIndex>
			<numIndex index="1">preset:blog</numIndex>
		</numIndex>
		<numIndex index="2" type="array">
			<numIndex index="0">latest Posts</numIndex>
			<numIndex index="1">blog->latestPosts</numIndex>
		</numIndex>
		<numIndex index="3" type="array">
			<numIndex index="0">default</numIndex>
			<numIndex index="1">comment->new;comment->edit</numIndex>
		</numIndex>
	</items>
</config>



How does that sound to you? That way you can do whatever you like - 
either directly assign controller->actions or define some more complex 
presets if those are subject to change. You could also only use presets.

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list