If we want to Replace the value in twig template then we have an example and syntax, please have a look..
{#
**** replace '-' with '$' sign in vidyard ID ****
#}
{% set twig_content_variable = node.field_resources_vidyard_id.value %} // here we are applying on field_resources_vidyard_id field..
{% set replace_value_var = '-' %}
{% set replace_with_value_var = '$' %}
{%if twig_content_variable %}
{% set vidyard_function_id = twig_content_variable|replace({ '-': '$' }) %}
{% endif %}
Note: If have any suggestions or issue regarding 'Replace any string or value in twig template variable.' then you can ask by comments.
{#
**** replace '-' with '$' sign in vidyard ID ****
#}
{% set twig_content_variable = node.field_resources_vidyard_id.value %} // here we are applying on field_resources_vidyard_id field..
{% set replace_value_var = '-' %}
{% set replace_with_value_var = '$' %}
{%if twig_content_variable %}
{% set vidyard_function_id = twig_content_variable|replace({ '-': '$' }) %}
{% endif %}
Note: If have any suggestions or issue regarding 'Replace any string or value in twig template variable.' then you can ask by comments.
Nice article. Its very useful for me
ReplyDeleteCan you Please create a article for paragraph fields, how to call paragraph fields on twig template.
ReplyDeleteHi,
DeleteWe have an article for paragraph fields render on node twig file, please have a look..
https://drupalwebsolutions.blogspot.com/2018/09/paragraph-fields-render-in-drupal-8.html