Block editing/creaton - input format unhidden?

netron - May 22, 2008 - 08:56

Hello Drupal community,

When creating a block I would like the "input format" area to be unhidden (filtered html or full html) , rather than having to click on the arrow graphic to make that div appear.

Is there a config setting i can set that will make it always appear if i am creating or editing a block?

I battle to follow what you

Mark Theunissen - May 22, 2008 - 09:09

I battle to follow what you are trying to do.

Are you talking about the page at admin/build/block/add ?

Because that doesn't show input format options, but that's the only place you can create a block?

__________________________________________________________

Mark Theunissen

Code Baboon
Drupal based services

admin/build/block ->

netron - May 22, 2008 - 09:16

admin/build/block -> configure

and also

admin/build/block/add

but no matter , i've figured out how to make the "input format" uncollapsed by default.

edit modules/block/block.admin.inc

add this line to function block_admin_configure , right before "return $form;"

$form['block_settings']['body_field']['format']['#collapsed#']=0;

this might not be the best way to do it though - is there a config file somewhere , where i can switch this setting is 0 (off)?

You can write a new module

Mark Theunissen - May 22, 2008 - 11:23

You can write a new module that implements hook_form_alter(), and change the form in there.

That would be the proper way to do it! Check the API for more details.

__________________________________________________________

Mark Theunissen

Code Baboon
Drupal based services

i've implemented a formalter module

netron - May 23, 2008 - 11:02

i've implemented a formalter module , which loads ok into drupal, but i'm not sure how you can change the attributes of the block editing/creation form - namely, i want the "input format" to never be collapsed, or collapsible. the module i wrote below doesnt appear to be having any effect.

is there something i'm overlooking?

<?php
function formalter_help($path, $arg) {
 
$output = '';
  switch (
$path) {
    case
"admin/help#formalter":
     
$output = '<p>'t("Overrides form defaults.")
.
'</p>';
      break;
  }
  return
$output;
}
// function formalter_help



/*
telling drupal who can use your module - permissions
http://drupal.org/node/206757
*/
function formalter_perm() {
return array(
'access formalter content');
}
//function formalter_perm()

/**
* Generate HTML for the formalter block
* @param op the operation from the URL
* @param delta offset
* @returns block HTML
*/
function formalter_block($op = 'list', $delta = 0) {

}
// end function onthisdate_block


function hook_form_alter(&$form, $form_state, $form_id) {

if (
$form['block_settings']['body_field']['format']['#collapsible']==1)
{

// ensure that 'input format' on a block form is never collapsed

$form['block_settings']['body_field']['format']['#collapsible']=0;
$form['block_settings']['body_field']['format']['#collapsed']=0;
}

}
?>

not to worry - i've figured

netron - May 23, 2008 - 11:39

not to worry - i've figured out how to do it , thanks to this excellent tutorial on form altering:
http://groups.drupal.org/node/4308

i'll post my code in just a sec.

 
 

Drupal is a registered trademark of Dries Buytaert.