0

enter image description here

Is there a way that I can create a module template and give it a name with spaces? At the moment it takes it's name from the file name, but that is not very neat for the user. Can we create a language string to override this? For example could we make the screenshot "default 2" instead.

How does Joomla! make default appear with a capital letter "Default"

And... as a second question. I'd like to add a hint so I can show users what the options are via an image. Would this be possible via a language string? I only want to do it for this specific module and not all of the Joomla! modules.

3
  • 1
    There is the option to create your own custom field.
    – FFrewin
    Commented Jan 19, 2018 at 11:10
  • Does that mean there is no way to do this in Joomla?
    – Eoin
    Commented Jan 19, 2018 at 17:55
  • @FFrewin I see what you mean now. That would be the way to get my custom image. Thank you. Any idea about the other part?
    – Eoin
    Commented Jun 11, 2019 at 16:02

1 Answer 1

3

The layout language key is built like this:

$key = strtoupper($module . '_LAYOUT_' . $value);

Where $module is the module name (including mod_ prefix) and $value is the layout name. Example string for mod_tags_popular module's layout strings:

MOD_TAGS_POPULAR_LAYOUT_CLOUD="Cloud"
MOD_TAGS_POPULAR_LAYOUT_DEFAULT="Default"

The language key for module layouts provided by templates is built like this:

$key = strtoupper('TPL_' . $template->element . '_' . $module . '_LAYOUT_' . $value);

Where $template->element is the element/name of the template, $module is the module name (including mod_ prefix) and $value is the layout name.

Example string for mod_custom module's alternative.php layout in Protostar template:

TPL_PROTOSTAR_MOD_CUSTOM_LAYOUT_ALTERNATIVE="Alternative"

Note, the string must be placed in the .sys.ini file, e.g. en-GB.tpl_protostar.sys.ini.

4
  • Wow, I genuinely didn't expect an answer. So this means the language string needs to have a version for all of the possible template names? That doesn't sound right, say it isn't so!
    – Eoin
    Commented Jun 11, 2019 at 16:35
  • @Eoin you only need a string for the template the layout belongs to.
    – Sharky
    Commented Jun 11, 2019 at 19:12
  • But a module layout can go with any template right? Or am I misunderstanding
    – Eoin
    Commented Jun 11, 2019 at 20:29
  • 2
    @Eoin, based on your screenshot I assumed you are shipping the layout as part of a template. If you're instead developing a module, the key doesn't need a template prefix. I have updated the answer to indicate this.
    – Sharky
    Commented Jun 11, 2019 at 20:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.