New Dynamic Data PHP Function return values

Bricks Version: 1.4 Beta

Hey there, I just played a bit with the new dynamic data PHP Function return values and it seems that there are 2 Scenarios not working:

  1. I want to pass a PHP Variable like so:
    { echo: returnValues($myVariable) }
    which results in the following output:
    {echo: returnValues($myVariable) }

  2. I want to use dynamic Data inside that function, like so:
    {echo: returnValues({post_title}) }
    which results in the following output
    {echo: returnValues(My Post Title)}

I don’t know if it’s intended to work that way, but it would be cool if those 2 scenarios could also get a look from the devs, maybe it’s just a case they didn’t think of! :wink:

TIA

1 Like

tuve el mismo problema con parametros, lo bueno es que la funcion hereda los valores de post asi que puedes invocar al ID y continuar con lo que desees.
saludos

Hi Ronald,
Welcome to the forum and thanks for reaching out!

Can you please write in English in the future? This way it is much easier for most users to understand. Thank you!

Best regards,
timmse

For anyone else stuck on this, what the guy is saying in english for the above post is:
I had the same problem with parameters, the good thing is that the function inherits the values ​​of post so you can call the ID and continue with what you want.
Cheers

1 Like

Is it possible to pass a variable inside output functions in Bricks builder?

For example:
Pass a dynamic value {je_meta_value} inside the returnValues function
{ echo: returnValues({je_meta_value}) }

Or pass the PHP Variable $myVariable inside the returnValues function

{ echo: returnValues($myVariable) }

In my case I cannot make it

This question was never answered. What is the official Bricks team response to whether dynamic data can be passed to an echo tag?

For example, if I have a PHP function “get_taxonomy_title_by_slug” to which I need to pass a URL parameter dynamic data “{url_parameter:cat}”.

Executing “{echo:get_taxonomy_title_by_slug({url_parameter:cat})}” results in “{echo:get_taxonomy_title_by_slug(my-category)}” appearing on the front end. The echo is never executed.

Hi guys,
Sorry… the thread seems to have slipped through the cracks despite my reply back then.

It depends on where the echo tag is used, as there are already several other reports on “nested dynamic data tags”:

  1. WIP: Using a variable in custom function inside a query loop doesn't work
  2. WIP: Dynamic data is not rendered on links titles
  3. DUPLICATE: Query builder - Not possible to add arguments to function in meta query

So, can you please make your question a little more specific and describe the whole scenario so that we can reproduce the problem if necessary?

The problem is that one can’t use dynamic data (not sure if it’s all dynamic data or just certain ones) in an echo statement which calls a custom PHP function. My example again, if I have a PHP function “get_taxonomy_title_by_slug” to which I need to pass a URL parameter dynamic data “{url_parameter:cat}”.

Executing “{echo:get_taxonomy_title_by_slug({url_parameter:cat})}” results in “{echo:get_taxonomy_title_by_slug(my-category)}” appearing on the front end (the url parameter is ?cat=my-category). The echo is never executed.

Is this ever going to be answered?

get_query_var('cat')

use in function get_taxonomy_title_by_slug

Not sure that answers the question really

Answer - You can’t put a dynamic tag inside of an echo dynamic tag, no. There may be exceptions, but generally not. You can only use functions that return values, like get_query_var(), not other dynamic tags.

It’s marked as WIP and duplicate for the previous times it’s been asked, so best to assume the answer will be the same - “I reproduced the issue and added it to our bug tracker”. This will be marked as duplicate i expect as it’s all the same thing being reported from what I can tell.