Scroll
Problem mit hook_block_info
Foren
Guten Tag!
Ich versuche, Blöcke programmgesteuert zu erstellen.
Ich mache es in meinem Modul so
function about_block_info(){
$blocks['about_company'] = array(
'info' => 'Über das Unternehmen',
'status' => TRUE,
'region' => '',
'weight' => 0,
'visibility' => 1,
'cache' => DRUPAL_NO_CACHE,
);
$blocks['first_red_text_item'] = array(
'info' => 'Popup-Text für die erste Spalte des roten Blocks (Startseite)',
'status' => TRUE,
'region' => '',
'weight' => 0,
'visibility' => 1,
'cache' => DRUPAL_NO_CACHE,
);
return $blocks;
}
function about_block_configure($delta){
$form = array();
switch($delta){
case 'about_company':
$form['about_content_title'] = array(
'#type' => 'textfield',
'#title' => 'Titel des Blocks auf der Startseite',
'#size' => 15,
'#description' => 'Zum Beispiel: "Über das Unternehmen"',
'#default_value' => variable_get('about_company_title','Über das Unternehmen'),
);
$form['about_content_text'] = array(
'#type' => 'textarea',
'#title' => 'Mini-Text auf der Startseite',
"#rows" => 5,
"#cols" => 20,
'#description' => 'Wird als Vorschau-Text auf der Startseite angezeigt',
'#default_value' => variable_get('about_company_text','Dies war die erste inländische offiziell registrierte unabhängige Bildungseinrichtung in unserem Land, das damals noch als UdSSR bezeichnet wurde. Sie wurde mit dem Ziel gegründet, hochqualifizierte professionelle Übersetzer auszubilden, da es zu dieser Zeit keine ähnlichen Bildungseinrichtungen in der UdSSR gab. '),
);
$form['address'] = array(
'#type' => 'textfield',
'#title' => 'Adresse der Seite mit Unternehmensdaten',
'#size' => 15,
'#description' => 'Zum Beispiel: about',
'#default_value' => variable_get('about_company_address','about'),
);
break;
case 'first_red_text_item':
$form['first_red_text'] = array(
'#type' => 'textarea',
'#title' => 'Text für das Popup-Fenster (erste Spalte)',
"#rows" => 5,
"#cols" => 20,
'#description' => 'Popup-Text',
'#default_value' => variable_get('first_red_text1',''),
);
$form['first_red_text_address'] = array(
'#type' => 'textfield',
'#title' => 'Adresse der Seite, auf die der Popup-Text verweist',
'#size' => 15,
'#description' => 'Zum Beispiel: about',
'#default_value' => variable_get('first_red_text_address1',''),
);
break;
}
return $form;
}
function about_block_save($delta = '', $edit = array()){
switch($delta){
case 'about_company':
variable_set('about_company_title',$edit['about_content_title']);
variable_set('about_company_text',$edit['about_content_text']);
variable_set('about_company_address',$edit['address']);
break;
case 'first_red_text_item':
variable_set('first_red_text1',$edit['first_red_text']);
variable_set('first_red_text_address1',$edit['first_red_text_address']);
break;
}
return;
}
:
So erscheint im Admin-Bereich der Block "Über das Unternehmen" und funktioniert alles richtig, aber der zweite Block nicht. Wo liegt der Fehler?
- Anmelden, um Kommentare verfassen zu können