Feature #38942

Make data of ContentElement available in Fluid

Added by Felix Nagel over 5 years ago. Updated 6 months ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Fluid
Target version:
-
Start date:
2012-07-13
Due date:
% Done:

0%

PHP Version:
Tags:
Complexity:
Sprint Focus:

Description

Please make CE uid available in fluid. See http://lists.typo3.org/pipermail/typo3-project-typo3v4mvc/2012-April/012164.html

This is often needed when using Java-Script within the templates.

Associated revisions

Revision ca0d46cb (diff)
Added by Claus Due over 1 year ago

[FEATURE] Info ViewHelpers for page and content information array

Adds ViewHelpers ``f:info.page`` and ``f:info.content`` which return
or assign content or page information arrays respectively depending
on usage of the ``as`` argument as known from other helpers.

Change-Id: Idfa5b68b37e926593072ddf75e6d143a2c5037f8
Releases: master
Resolves: #38942
Reviewed-on: https://review.typo3.org/46473
Reviewed-by: Frank Naegler <>
Tested-by: Frank Naegler <>
Reviewed-by: Jan Helke <>
Tested-by: Jan Helke <>
Reviewed-by: Markus Klein <>
Tested-by: Markus Klein <>

History

#1 Updated by Oliver Hader over 5 years ago

  • Status changed from New to Accepted

Makes sense... the name should be configurable however...

#2 Updated by Marc Bastian Heinrichs over 5 years ago

I never needed the CE uid till now, so I think it should be handled extension specific.

But if the majority is +1, it should be implemented with FLOW3's FLUID in mind.
Function getContentObject() is v4/6 specific thing because FLOW3 has no content element
and if there would be anything like this, it has no uid, but an identifier.

#3 Updated by Felix Nagel over 5 years ago

I understand your concern but isn't extbase a TYPO3 extension and should we be worried about eventually upcoming FLOW3 based projects?
Anyway, what about a more generic, configurable way to retrieve a unique identifier?

Currently a viewHelper already has the uid in its context, but I needed the cObj when working inside partials.

class Tx_MyExt_ViewHelpers_UidViewHelper extends Tx_Fluid_Core_ViewHelper_AbstractViewHelper {

  /**
   * @var Tx_Extbase_Configuration_ConfigurationManagerInterface
   */
  protected $configurationManager;

  /**
   * @param Tx_Extbase_Configuration_ConfigurationManagerInterface An instance of the Configuration Manager
   * @return void
   */
  public function injectConfigurationManager(Tx_Extbase_Configuration_ConfigurationManagerInterface $configurationManager) {
    $this->configurationManager = $configurationManager;
  }

  /**
   * Set uid of the content element
   *
   * @return int $uid The uid of the content element
   */
  public function render() {
    // fallback
    $uid = uniqid();

    if ($this->templateVariableContainer->exists("contentObjectData")) {
      // this works for templates but not for partials
      $contentObjectData = $this->templateVariableContainer->get("contentObjectData");
      $uid = $contentObjectData['uid'];
    } else {
      // this should work in every circumstance
      $cObj = $this->configurationManager->getContentObject();
      $uid = $cObj->data['uid'];
    }

    return $uid;
  }
}

#4 Updated by Anja Leichsenring almost 5 years ago

  • Project changed from Extbase MVC Framework to Fluid
  • Category changed from 965 to Fluid

#5 Updated by Alexander Opitz about 3 years ago

  • Status changed from Accepted to Needs Feedback

Hi,

was this issue fixed or does it still exists?

#6 Updated by Felix Nagel about 3 years ago

Still missing in core afaik. So please, do not close this.

#7 Updated by Alexander Opitz about 3 years ago

  • Project changed from Fluid to Core
  • Category changed from Fluid to Fluid
  • Status changed from Needs Feedback to New

#8 Updated by Riccardo De Contardi over 2 years ago

+1 I would like it too!
(Maybe VHS has something ;))

#9 Updated by Claus Due about 2 years ago

Just a tiny update from the side lines: this issue has been reviewed, judging if it has any impact on or is affected by the merging of the standalone Fluid package as TYPO3 dependency.

Verdict: NOT AFFECTED. This feature should, however, be very carefully considered - my suggestion would be to add a ViewHelper in Fluid (the TYPO3 adapter, not the standalone package) that will return the current cObj as stored in ConfigurationManager.

#10 Updated by Bernhard Eckl almost 2 years ago

Why only the uid of the content element and not all content element properties? I would need section_frame or layout…

#11 Updated by Claus Due almost 2 years ago

Does anyone want this anymore? It doesn't appear to be a hot topic... ;)

#12 Updated by Riccardo De Contardi almost 2 years ago

From my part, I continue to think it could be useful :)

#13 Updated by Markus Klein over 1 year ago

We recently needed this. Shall we implement this somehow for CMS 8?

#14 Updated by Gerrit Code Review over 1 year ago

  • Status changed from New to Under Review

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/46473

#15 Updated by Gerrit Code Review over 1 year ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/46473

#16 Updated by Gerrit Code Review over 1 year ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/46473

#17 Updated by Gerrit Code Review over 1 year ago

Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/46473

#18 Updated by Gerrit Code Review over 1 year ago

Patch set 8 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/46473

#19 Updated by Gerrit Code Review over 1 year ago

Patch set 9 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/46473

#20 Updated by Gerrit Code Review over 1 year ago

Patch set 10 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/46473

#21 Updated by Gerrit Code Review over 1 year ago

Patch set 11 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/46473

#22 Updated by Gerrit Code Review over 1 year ago

Patch set 12 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/46473

#23 Updated by Anonymous over 1 year ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#24 Updated by Helmut Hummel over 1 year ago

  • Status changed from Resolved to New

The merged patch did not solve this ticket and was reverted due to several other issues

Revert: https://review.typo3.org/#/c/47209/

#25 Updated by Helmut Hummel over 1 year ago

  • % Done changed from 100 to 0

#26 Updated by Benjamin Kott 9 months ago

  • Status changed from New to Needs Feedback

Hey, mabe someone can point me here into the right direction. Personally i would consider this issue as resolved. If you assign a fluidtemplate for the content element rendering it has automaticly the record information as data assigned. When using extbase you have also all Information available in the context but it needs to be assignes manually to the view. Is there something i am missing?

#27 Updated by Markus Klein 9 months ago

@Benji: AFAIK we still lack the page information in a FLUIDTEMPLATE.

#28 Updated by Alexander Opitz 6 months ago

  • Subject changed from Make CE UID available in Fluid to Make data of ContentElement available in Fluid
  • Status changed from Needs Feedback to New

Also available in: Atom PDF