the css file style.css never get loaded when using the form api #attached properties. here is my code:
mymodule_menu() {
$items['test'] = array (
'title' => t('test css'),
'page callback' => 'drupal_get_form',
'page arguements' => array('test_attach_css'),
'access callback' => TRUE,
);
return $items;
}
function test_attach_css($form,$form_state) {
$markup = '<p class="test">style the font as red</p>';
$form['content']['#markup'] = $markup;
$form['content']['#attached']['css'][] = drupal_get_path("module", "mymodule")."/style.css";
return $form;
}
the content of css file:
.test {
color:red;
}
kpr(drupal_get_path("module", "mymodule")."/style/style.css");
?