Project

General

Profile

Actions

Feature #12868

closed

Make row detail view customizable

Added by Francois Suter over 13 years ago. Updated over 5 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Workspaces
Target version:
-
Start date:
2011-02-08
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Complexity:
Sprint Focus:

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

12868.diff (835 Bytes) 12868.diff Francois Suter, 2011-02-08 11:45
T3X_test12868-0_0_1-z-201106281834.t3x (1.93 KB) T3X_test12868-0_0_1-z-201106281834.t3x Francois Suter, 2011-06-28 18:35

Related issues 1 (0 open1 closed)

Blocked by TYPO3 Core - Feature #27442: Difference arrays contain insufficient informationClosed2011-06-14

Actions
Actions #1

Updated by Francois Suter over 13 years ago

Actions #2

Updated by Francois Suter over 13 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;
}

Actions #3

Updated by Tolleiv Nietsch over 13 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.

Actions #4

Updated by Francois Suter over 13 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.

Actions #5

Updated by Francois Suter about 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?

Actions #6

Updated by Francois Suter about 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.

Actions #7

Updated by Francois Suter about 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?

Actions #8

Updated by Mr. Hudson almost 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

Actions #9

Updated by Francois Suter almost 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.

Actions #10

Updated by Mr. Hudson almost 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

Actions #11

Updated by Tolleiv Nietsch over 12 years ago

  • Status changed from Accepted to Resolved
  • TYPO3 Version set to 4.6

Has been merged in the meantime - thanks a lot :)

Actions #12

Updated by Michael Stucki over 10 years ago

  • Category set to Workspaces
Actions #13

Updated by Michael Stucki over 10 years ago

  • Project changed from 624 to TYPO3 Core
  • Category changed from Workspaces to Workspaces
  • Target version deleted (4.6)
Actions #14

Updated by Benni Mack over 5 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF