By knpwrs on
The title, explains my situation, here is my code (what I am focusing on):
//CSS
drupal_add_css($extjs_path ."/ext-libs/resources/css/ext-all.css");
//Is theme variable set?
if (variable_get(extjs_css,NULL) != NULL) {
drupal_add_css($extjs_path .'/ext-libs/resources/css/'. variable_get(extjs_css) .'.css');
}
I have also tried:
//CSS
drupal_add_css("/ext-libs/resources/css/ext-all.css");
//Is theme variable set?
if (variable_get(extjs_css,NULL) != NULL) {
drupal_add_css('/ext-libs/resources/css/'. variable_get(extjs_css) .'.css');
}
drupal_add_js() is working fine.
Here is the complete extjs.module:
// $Id$
/**
* This module lets users install extjs on their site and configure it through
* an administration interface. A test block is also provided for testing.
*/
/**
* implementation of hook_perm()
*/
function extjs_perm() {
return array('administer Ext JS');
}
/**
* implementation of hook_help()
*/
function extjs_help($path, $arg) {
if ($path == 'admin/help#extjs') {
$txt = 'This module lets users install and configure extjs on their'.
' drupal site. Users with \'administer Ext JS\' permissions can'.
' configure Ext JS.';
return '<p>'. t($txt) .'</p>';
}
}
/**
* Implementation of hook_menu()
*/
function extjs_menu() {
$items['admin/settings/extjs'] = array(
'title' => 'Configure Ext JS',
'page callback' => 'drupal_get_form',
'page arguments' => array('extjs_admin_settings'),
'description' => t('Ext JS Settings'),
'access arguments' => array('administer Ext JS'),
'type' => MENU_CALLBACK,
);
return $items;
}
//Menu Function
function extjs_admin_settings() {
$form['extjs_settings'] = array(
'#type' => 'fieldset',
'#title' => t('Ext JS Settings'),
'#description' => t('Settings for the extjs module are in this fieldset')
);
$form['extjs_settings']['extjs_css'] = array(
'#type' => 'textfield',
'#title' => t('Theme for Ext JS widgets'),
'#maxlength' => 100,
'#default_value' => variable_get(extjs_css,NULL),
'#size' => 70,
'#description' => t('Name of the css file which contains the theme to use (located in resources/css). Blank = default')
);
$form['extjs_settings']['extjs_mode'] = array(
'#type' => 'radios',
'#title' => t('Ext JS Mode'),
'#description' => t('Ext JS mode: Debug (uncompressed libs), Production (compressed libs), or Custom (build to ext.js).'),
'#default_value' => variable_get(extjs_mode,1),
'#options' => array(
t('Debug'),
t('Production'),
t('Custom'),
),
);
$form['extjs_settings']['extjs_adapter'] = array(
'#type' => 'checkbox',
'#title' => t('Jquery Adapter'),
'#description' => t('Check the box to use the jquery adapter.'),
'#default_value' => variable_get(extjs_adapter,0),
);
return system_settings_form($form);
}
// Add CSS/JS
$extjs_path = drupal_get_path('module','extjs');
//Use Adapter?
if (variable_get(extjs_adapter,0)==1) {
drupal_add_js($extjs_path ."/ext-libs/adapter/jquery/ext-jquery-adapter.js");
} else {
drupal_add_js($extjs_path ."/ext-libs/adapter/ext/ext-base.js");
}
//Include correct ext-all:
if (variable_get(extjs_mode,2)==0) {
drupal_add_js($extjs_path ."/ext-libs/ext-all-debug.js");
} else if (variable_get(extjs_mode,2)==2) {
drupal_add_js($extjs_path ."/ext-libs/ext.js");
} else {
drupal_add_js($extjs_path ."/ext-libs/ext-all.js");
}
//CSS
drupal_add_css($extjs_path ."/ext-libs/resources/css/ext-all.css");
//Is theme variable set?
if (variable_get(extjs_css,NULL) != NULL) {
drupal_add_css($extjs_path .'/ext-libs/resources/css/'. variable_get(extjs_css) .'.css');
}
Can somebody help me figure out what's going on here?
Also, for those who haven't figured it out: I'm trying to implement Ext JS into Drupal 6.
Comments
Bump: Anybody?
Bump: Anybody?
2 parameters?
Doesn't variable_get require 2 parameters? This is missing in drupal_add_css.
Regards
Werner