Project

General

Profile

Actions

Feature #68717

closed

TypoScript: Add general PHP function call to stdWrap

Added by Elmar Hinz over 9 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Could have
Assignee:
Category:
TypoScript
Target version:
Start date:
2015-08-04
Due date:
% Done:

0%

Estimated time:
PHP Version:
Tags:
Complexity:
no-brainer
Sprint Focus:

Description

TypoScript examples

Simple:

http://php.net/manual/en/function.ucwords.php

    page.10 = TEXT
    page.10.value = hello world
    page.10.phpFunction = ucwords

More parameters:

http://php.net/manual/en/function.sprintf.php

    page.10 = TEXT
    page.10.value = There are %d monkeys in the %s
    page.10.phpFunction = sprintf
    page.10.phpFunction.parameters.1 = 5
    page.10.phpFunction.parameters.2 = tree

The parameters are of type string/stdWrap.

This means by default the incoming content is parameter 0. This is the same as:

    page.10 = TEXT
    page.10.phpFunction = sprintf
    page.10.phpFunction.parameters.0 = There are %d monkeys in the %s
    page.10.phpFunction.parameters.1 = 5
    page.10.phpFunction.parameters.2 = tree

How do we access the incoming content in parameter 2?

http://php.net/manual/en/function.str-replace.php

    page.10 = TEXT
    page.10.value = 
    page.10.phpFunction = str_replace
    page.10.phpFunction.parameters.0 = %body%
    page.10.phpFunction.parameters.1 = black
    page.10.phpFunction.parameters.2 ???

If possible by the stdWrap of the parameter. Any suggestions?

Details:

The return parameter is always casted to string for the beginning, even if array or object. Future versions may offer a more skilled treatment of the return parameter by a property named return.

Personal motivation:

I want to learn the contribution workflow.


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Task #68733: Cleanup ContentObjectRenderer: Introduduce an Interface for processors of stdWrapRejectedElmar Hinz2015-08-04

Actions
Actions #1

Updated by Elmar Hinz over 9 years ago

The last example should be like this, but I don't find a way to modify it myself.

    page.10 = TEXT
    page.10.value = There are %d monkeys in the %s
    page.10.phpFunction.parameters.0 = %body%
    page.10.phpFunction.parameters.1 = black
    page.10.phpFunction.parameters.2 ???

Please coach me with my first gerrit walkthrough.

Actions #2

Updated by Wouter Wolters over 9 years ago

Please discuss this first in the #typo3-cms-coredev channel on Slack (https://forger.typo3.org/slack) if this gets an go.

If accepted they can also help you getting started with the contribution workflow.

Thanks.

Actions #3

Updated by Elmar Hinz over 9 years ago

Summary of discussion on #typo3-cms-coredev: Useful, but risky to give TypoScript developers direct access to PHP.

Bottom line: TypoScript developers are still second class citizens today with limited responsibility. :->

Can be closed.

Actions #4

Updated by Susanne Moog over 9 years ago

  • Status changed from New to Closed

Closed in light of comment #3

Actions

Also available in: Atom PDF