From the following string:
"I am looking for {{ attribute_a }} with {{ attribute_b }} to make {{ attribute_c }}":
I am trying to create the following array structure:
[
[0] => [
"type" => "text",
"content" => "I am looking for"
],
[1] => [
"type" => "dropdown",
"name" => "attribute_a"
],
[2] => [
"type" => "text",
"content" => "with"
],
[3] => [
"type" => "dropdown",
"name" => "attribute_b"
],
[4] => [
"type" => "text",
"content" => "to make"
],
[5] => [
"type" => "dropdown",
"name" => "attribute_c"
]
]
So the string needs to be cut into parts with "{{ * }}" as a delimiter. But then I need the value inside the delimiter too.
- If the part is outside the delimiter it is a type of text with content.
- If it is inside the delimiter it is a type of dropdown with a property of the name.