Page 1 of 1

Admin CSS in modules

Posted: Thu Apr 02, 2009 6:23 pm
by brippon
While writing a module that includes a number of admin forms, I wanted to dictate the size of some textarea's to reduce space. Following the docs:

Code: Select all

void   CreateTextArea  (bool $enablewysiwyg, string $id, string $text,
string $name, [string $classname = ''], [string $htmlid = ''], [string $encoding = ''],
[string $stylesheet = ''], [string $width = '80'], [string $cols = '15'], [string $forcewysiwyg = ""]) 
I first tried specifying the $width and $cols, to no avail. The size of textareas is overridden by the theme's style.css.

Although you can specify a $classname, there seem to be no way to declare the class in admin css, short of creating a whole theme...

Eventually I found from the source that the function supports an undocumented $addtext parameter:

Code: Select all

function CreateTextArea($enablewysiwyg, $id, $text,
$name, $classname='', $htmlid='', $encoding='', $stylesheet='', $cols='80', 
$rows='15',$forcewysiwyg='',$wantedsyntax='',$addtext='')
so I could call it using the rather untidy:

Code: Select all

$this->CreateTextArea(false, $id, $address, 'address','','','','','','','','',
'style="width: 18em; height: 6em;"')
It would be neater if a module could provide its own CSS (e.g. /modules/modulename/css/modulename.css) which were included in the module's admin pages after the theme CSS, allowing it to override or supplement it.

Is there a better way of solving the problem?

Brian

Re: Admin CSS in modules

Posted: Thu Apr 02, 2009 7:34 pm
by milehigh
I just deleted the  width: 48em;  height: 30em; from the textarea style called out in style.css for that theme. Then when you specify width and cols it works as expected.