public function Popup_announcement_block::create_block in Pop-up announcement 7
Create new block with fields
Return value
array Standard settings and localized welcome text
File
- ./
popup_announcement.module, line 337 - Primarily Drupal hooks and custom functions for creating block with pop-up announcement.
Class
- Popup_announcement_block
- Class for work with block with announcements
Code
public function create_block() {
// welcome text on current language
// get locale and create first announcement from template if possible, or standard 'en'.
$default_language = language_default();
$welcomes = scandir(DRUPAL_ROOT . '/' . drupal_get_path('module', 'popup_announcement') . '/welcomes');
$f = in_array($default_language->language . '.html', $welcomes) ? $default_language->language . '.html' : 'en.html';
$text = file_get_contents(DRUPAL_ROOT . '/' . drupal_get_path('module', 'popup_announcement') . '/welcomes/' . $f);
return array(
'bid' => FALSE,
'name' => FALSE,
'text' => $text,
'number_visit' => '1,2,5',
'width' => 500,
'height' => 300,
'created' => time(),
'delay' => 2,
);
}