Jump to content

Longer file names cutoff in the admin


Jim Bailie
 Share

Recommended Posts

InputfieldFile has several settings that don't have config fields in the admin. See here: https://github.com/processwire/processwire/blob/5609935e4ee96611965550e57d3139200de95c35/wire/modules/Inputfield/InputfieldFile/InputfieldFile.module#L20-L26
I'm not sure of the reasons why but perhaps the thinking is that they would only needed for specialised uses of the inputfield.

You could use a hook in /site/ready.php to add a config field for that setting to all files fields if you want to set it per field:

$wire->addHookAfter('InputfieldFile::getConfigInputfields', function(HookEvent $event) {
	/** @var InputfieldFile $inputfield */
	$inputfield = $event->object;
	/** @var InputfieldWrapper $wrapper */
	$wrapper = $event->return;
	/** @var InputfieldCheckbox $f */
	$f = $event->wire()->modules->get('InputfieldCheckbox');
	$f->name = 'noShortName';
	$f->label = 'Disable abbreviated filenames';
	$f->label2 = 'Disable abbreviated filenames in inputfield';
	$f->collapsed = Inputfield::collapsedBlank;
	$f->checked($inputfield->noShortName);
	$wrapper->add($f);
});

image.png.82dcf2be9cb38ce6b948defc64bb4a10.png

 

Or if you want to disable it for all file fields:

$wire->addHookAfter('InputfieldFile::renderReadyHook', function(HookEvent $event) {
	/** @var InputfieldFile $inputfield */
	$inputfield = $event->object;
	$inputfield->noShortName = true;
});

 

  • Like 2
  • Thanks 1
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...