Created
April 21, 2015 06:43
-
-
Save jibran/b646dbc4177b7f044fd1 to your computer and use it in GitHub Desktop.
Create a custom block.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function my_module_update_xxxx () { | |
$query = db_insert('block_custom') | |
->fields(array( | |
'body' => 'Some markup', | |
'info' => 'Some title for info', | |
'format' => 'rich_text', | |
)); | |
$bid = query->execute(); | |
db_insert('block') | |
->fields(array( | |
'module' => 'block', | |
'delta' => $bid, | |
// Active theme. | |
'theme' => 'my_theme', | |
'status' => 1, | |
'weight' => 0, | |
// It places the block in content region. | |
'region' => 'content', | |
// It will be visible on all pages. | |
'pages' => '', | |
// It will use the info set above as a title. | |
'title' => '', | |
)) | |
->execute(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment