Jump to content

How to output value of multilanguage module config field on the frontend?


Juergen
 Share

Recommended Posts

Hello,

I have a multilang field in my module configuration - it is a text field.

// Required hint custom text
        $requiredText = wire('modules')->get('InputfieldText');
        $requiredText->name = 'input_requiredText';
        $requiredText->label = $this->_('Hint that all required fields have to be filled out');
        $requiredText->value = $this->input_requiredText; // here is the value
        $reqText = $this->_('This text will be displayed on the form depending on your settings.') . '<br>';
        $reqText .= $this->_('If nothing is entered, a default text will be displayed instead.');
        $requiredText->description = $reqText;
        $requiredText->notes = $this->_('Can be overwritten on each form.');
        $requiredText->useLanguages = true; // enable multilanguage for this field 
        $requiredText->showIf = "input_requiredHintPosition!=none";
        $fieldset1->add($requiredText);

 

 

1720886510_Screenshot2022-07-11at12-54-04ModuleFrontendFormswebseite1_at.png.c748659c131604a727ebab396a0cb353.png

The values will be stored as followed inside the db:

"input_requiredText":"My custom text","input_requiredText__1012":"Das ist mein Custom Text","input_requiredText__1013":""

I want to output the values depending on the users language on the frontend

Question: Is there an easy way to grab this values on the frontend?

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...