Accessing another Translatable Field #402
-
This might be something super simple that I'm missing. Is it possible to get the fields of another translatable/option field?
This seems super simple but I'm not sure how to get the field. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hey @DavidZudu yes, you can do this easily: inside your components functions.php file: add_filter('Flynt/addComponentData?name=Bar', function ($data) {
$data['trans'] = Options::getTranslatable('Foo');
return $data;
}); Then inside your twig file you can use Hint: you need to have Hope that helps. |
Beta Was this translation helpful? Give feedback.
Hey @DavidZudu
yes, you can do this easily:
inside your components functions.php file:
Then inside your twig file you can use
{{ trans.X }}
to access the translation. If you cannot access the value try to use {{ dump(trans) }} to see if the data is nested or similar.Hint: you need to have
define( 'WP_DEBUG', true );
in your site's wp-config.php to see the dump values.Hope that helps.
Aaron