Admin CSS in modules

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
brippon
Forum Members
Forum Members
Posts: 18
Joined: Wed Feb 07, 2007 10:28 pm

Admin CSS in modules

Post 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
milehigh

Re: Admin CSS in modules

Post 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.
Post Reply

Return to “Developers Discussion”