Jump to content

mach

Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by mach

  1. Hi, as an example, if I have set up a module with the following code for the config fields:

    public static function getModuleConfigInputfields(array $data) {
    
        $inputfields = new InputfieldWrapper(); 
    
        $field = wire('modules')->get('InputfieldText');
        $field->name = 'headline_default';
        $field->label = "Please enter the headline:";
        $inputfields->add($field); 
    
        return $inputfields; 
    }
    

    Is there a way for the input fields to support multiple languages, similar to TextLanguage fields?  The only alternative that I can think of now is to code in multiple fields for each language:

    public static function getModuleConfigInputfields(array $data) {
    
        $inputfields = new InputfieldWrapper(); 
    
        $field = wire('modules')->get('InputfieldText');
        $field->name = 'headline_default';
        $field->label = "Please enter the promo headline:";
        $inputfields->add($field); 
    
        $field = wire('modules')->get('InputfieldText');
        $field->name = 'headline_french';
        $field->label = "Please enter the promo headline (French):";
        $inputfields->add($field); 
    
        return $inputfields; 
    }
    

    but that's not dynamic and would become a hassle if I add multiple modules and/or languages in the future.

×
×
  • Create New...