Advertisement
Guest User

Untitled

a guest
May 24th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. <?php
  2.  
  3. function mymodule_block_info()
  4. {
  5. $blocks = array();
  6. $add = db_select('mymodule_blocks_data', 'n')
  7. ->fields('n', array('delta', 'title', 'content_type'))
  8. ->condition('n.form_type', 'Add', '=')
  9. ->execute();
  10. foreach ($add as $row) {
  11. $blocks[$row->delta] = array(
  12. 'info' => t('@name (Add Form Block) Type: @type', array('@name' => $row->title, '@type' => $row->content_type)),
  13. 'cache' => DRUPAL_NO_CACHE,
  14. );
  15. }
  16.  
  17. $edit = db_select('mymodule_blocks_data', 'n')
  18. ->fields('n', array('delta', 'title', 'content_type', 'nid'))
  19. ->condition('n.form_type', 'Edit', '=')
  20. ->execute();
  21. foreach ($edit as $row) {
  22. $blocks[$row->delta] = array(
  23. 'info' => t('@name (Edit Form Block) Nid: @nid', array('@name' => $row->title, '@nid' => $row->nid)),
  24. 'cache' => DRUPAL_NO_CACHE,
  25. );
  26. }
  27.  
  28. return $blocks;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement