Feature #54155

f:render partial="" package=""

Added by Kay Strobach over 8 years ago. Updated over 8 years ago.

Status:
Rejected
Priority:
Could have
Category:
ViewHelpers
Target version:
-
Start date:
2013-12-03
Due date:
% Done:

0%

Estimated time:
Has patch:
No

Description

Hi guys,

especially when developing Applications, which rely on an AbstractController, which sets the layout it would be nice to have a way to use the centralized defined partials and the one from each package.
Therefore it would be nice to have a package attribute for finding the related partial.


Related issues

Related to TYPO3.Fluid - Feature #50826: add resource as parameter for <f:render partial="resource://MyVendor.Package/Private/Partials/SomePartial" /> ClosedBastian Waidelich2013-08-06

Actions
Is duplicate of TYPO3.Fluid - Feature #33487: Configure from what package to use Templates/Partial/LayoutsClosedBastian Waidelich2012-01-27

Actions
#1

Updated by Bastian Waidelich over 8 years ago

  • Status changed from New to Rejected
  • Assignee set to Bastian Waidelich
  • Priority changed from Must have to Could have

Hey Kay,
thanks for the feature request, but this is already possible with the Views.yaml configuration

#2

Updated by Bastian Waidelich over 8 years ago

Example (untested):

-
  requestFilter: 'isPackage("Some.Package") && isController("Some")'
  options:
    partialRootPaths: ['resource://Other.Package/Private/Partials']

#3

Updated by Kay Strobach over 8 years ago

following situation:

  • layout uses partials from the root package.
  • Controller uses partials from the package where is resides.

This is also interesting for the bootstrap package ... AFAIK this is NOT possible - or do i have to add many pathes?

Then this can be changed into a Documentation Issue ;)

#4

Updated by Rafael Kähm over 8 years ago

for using partials across packages add in your packages, which supply other Packages with partials,
Views.yaml with following stuff:

-
  options:
    partialRootPaths:
      'You.Package/Partials': 'resource://You.Package/Private/Partials'

If your partial has unique name Fluid will find this partial. If you have multiple partials in different packages with same name, then put the partials in subfolders to facilitate finding a requered partial:

<f:render partial="SubfolderFromPartialRootPath/NavBarLoginBox" />

Note: Fluid uses first partial, which it finds.

#5

Updated by Bastian Waidelich over 8 years ago

Rafael Kähm wrote:

If your partial has unique name Fluid will find this partial. If you have multiple partials in different packages with same name, then put the partials in subfolders to facilitate finding a requered partial:
'You.Package/Partials': 'resource://You.Package/Private/Partials'

This example might be a bit misleading:
While it's a good idea to use named array indexes (so that it can be overridden more easily by 3rd party packages) the array key does not really matter.

Kay Wienöbst With the "supported options" introduced with https://review.typo3.org/16393 I think all common scenarios can be covered.
"partialRootPaths" is an array in order to allow you to create arbitrary fallbacks:

-
  requestFilter: 'isPackage("Some.Package") && isController("Some")'
  options:
    partialRootPaths:
      'Some.Package': 'resource://Some.Package/Private/Partials'
      'Other.Package': 'resource://Other.Package/Private/Partials'

Would always first look in Some.Package and fallback to Other.Package if a partial wasn't found. With the requestFilter you can decide for which requests this fallback rule should apply.

NOTE: To many of those complex rules can make your application very hard to grasp! I usually prefer to keep all templates, layouts & partials in one place - for 3rd party packages I copy them to my App package. This has the drawback that you need to sync changes when you update, but I prefer to do this explicitly anyways

Also available in: Atom PDF