Feature #12868
closedMake row detail view customizable
0%
Description
It is currently not possible to customize the row detail view in the workspaces module. I stumbled upon this issue with the usage of extension "tagpack", which provides a good example of the need for this. The Tag Pack does not a true database field to all the tables that are tagged. Instead it uses a number of hooks throughout the TYPO3 Core to dynamically add a "Tags" tab to the tagged items in TCEforms and some TCEmain hooks to handle the results.
What this leads to, however, is that no difference view can be made for this fields since it does not exist formally in the database, not in the TCA of the tagged tables.
What I'm proposing is to add a hook to the row detail view (see attached patch) that makes it possible for extensions to insert themselves in the process and add custom information for both the live record and the difference view.
I hope this will open a discussion about this as this is just a proposal. One may argue that this should be done at Core-level, so that other difference views (history, maybe) could be used. I looked into the whole process and my impression is that it would require to hook into such methods as t3lib_BEfunc::getRecord(), whose use is so widespread that I would rather avoid putting a hook in there.
Opinions are welcome.
Files
Updated by Francois Suter almost 14 years ago
And here's some code from my locally modified version of "tagpack" to show how the proposed hook is used:
/** * This method responds to a hook in the workspaces module * It gets the tags for both the live and workspace version of the given record * and returns information about said tags * * @param object $parameter: container for information about the record being handled * @param array $diffReturnArray: list of differences per field * @param array $liveReturnArray: list of all fields from the live record * @param t3lib_diff $t3lib_diff: instance of the t3lib_diff class * @return void */ public function modifyDifferenceArray($parameter, &$diffReturnArray, &$liveReturnArray, $t3lib_diff) { $workspaceTags = $this->getTagsAsString($parameter->table, $parameter->uid); $liveTags = $this->getTagsAsString($parameter->table, $parameter->t3ver_oid); $liveReturnArray[] = array( 'label' => 'Tags', 'content' => $liveTags ); $diffReturnArray[] = array( 'label' => 'Tags', 'content' => $t3lib_diff->makeDiffDisplay($liveTags, $workspaceTags) ); } /** * Get the tags for a given record and concatenates their names * * @param string $table: name of the table to look up relations for * @param integer $id: primary of the record to look up relations for * @return string All tags attached to the record, comma-separated */ protected function getTagsAsString($table, $id) { $tagsString = ''; $tags = tx_tagpack_api::getAttachedTagsForElement($id, $table, FALSE, TRUE, TRUE); foreach($tags as $tagInformation) { if (!empty($tagsString)) { $tagsString .= ', '; } $tagsString .= $tagInformation['name']; } return $tagsString; }
Updated by Tolleiv Nietsch almost 14 years ago
- Status changed from New to Accepted
- Target version set to 4.6
Sounds good - I'd prefer to check if this patch could also work with TemplaVoila and with Languagevisibility before we commit it.
Updated by Francois Suter almost 14 years ago
Tolleiv Nietsch wrote:
Sounds good - I'd prefer to check if this patch could also work with TemplaVoila and with Languagevisibility before we commit it.
OK. I don't know about Languagevisibility, but I guess it should be ok with TemplaVoila, because the patch simply makes it possible to manipulate the diff and live arrays.
The issue I can see is that those 2 arrays are simple indexed array, so it's not easy to find a given entry (in my case I was adding one, so I didn't feel the need). So maybe the workspaces code can be modified a bit further to use the field names as keys for the array and make it associative. I don't think it will have an impact on the display and it would make it easy then to find a particular entry and modify it.
Updated by Francois Suter over 13 years ago
Looking again at this issue, I see that the target version has been set to 4.6. I don't think it's a good idea. I know that we have a policy of not introducing hooks in minor version updates, but there are special cases. If - as we wish it to be - my proposed hook can also be used for TemplaVoila - can you really imagine that it will take an upgrade to 4.6 to display TV differences, while 4.5 is expected to be supported for 3 years?
Updated by Francois Suter over 13 years ago
I will raise this matter in the v4 list (about the general policy of adding hooks in stable branches). As I already said, I can hardly imagine that this does not get solved in 4.5 over the whole course of LTS.
Updated by Francois Suter over 13 years ago
The principle of introducing new hooks in TYPO3 4.5 has been accepted, when these hooks are used by system extensions. So I'll go ahead and submit this officially. That goes through Gerrit too now, right?
Updated by Mr. Hudson over 13 years ago
Patch set 1 of change Ibe15ae0f5a57ecd3988e62b10b58a30976ea3f18 has been pushed to the review server.
It is available at http://review.typo3.org/2955
Updated by Francois Suter over 13 years ago
Adding a test extension which uses the hook, for easier testing. You should see "Dummy content: foo bar" added to any detail view.
Updated by Mr. Hudson over 13 years ago
Patch set 1 of change Ibe15ae0f5a57ecd3988e62b10b58a30976ea3f18 has been pushed to the review server.
It is available at http://review.typo3.org/2957
Updated by Tolleiv Nietsch over 13 years ago
- Status changed from Accepted to Resolved
- TYPO3 Version set to 4.6
Has been merged in the meantime - thanks a lot :)
Updated by Michael Stucki almost 11 years ago
- Project changed from 624 to TYPO3 Core
- Category changed from Workspaces to Workspaces
- Target version deleted (
4.6)