Change Logo Image Setting

Hello there,

is there a way to change the logo option in the theme settings in OJS 3.2.1? The function modifyOptionsConfig seems to only be usable on the theme page, not the setup page (which is quite logical).
I would like to change the Label, because we are using the Logo in a slightly different way.

Kind regards
Daniela

Hi Daniela,

Yeah, as youā€™ve discovered the logo is not part of the theme options and so isnā€™t one of the fields configured by the theme. Instead, you can use a hook to modify the fields of any setup form. The one you want is FORM_APPEARANCE_SETUP. Something like this should work if you put it in your themeā€™s init method:

HookRegistry::register('Form::config::before', function($hookName, $form) {
	
	if (!defined('FORM_APPEARANCE_SETUP') || $form->id !== FORM_APPEARANCE_SETUP) {
		return;
	}

	// Look through $form->fields to find the field
	// with an id of pageHeaderLogoImage, and replace
	// the label with whatever you want. Something
	// like the following (untested)
	$form->fields = array_map(function($field) {
		if ($field->id === 'pageHeaderLogoImage') {
			$field->label = __('your.custom.locale.key');
		}
		return $field;
	}, $form->fields);

	return false;
});

Hi @NateWr,

thank you very miuch, I will try it out :slight_smile:

Kind regards
Daniela

1 Like

In case anyone else wants to do this: Insteadt of ā€œif ($field->id === ā€˜pageHeaderLogoImageā€™)ā€ it is ā€œif ($field->name === ā€˜pageHeaderLogoImageā€™)ā€.

Otherwise it works fine :slight_smile:

Kind regards
Daniela