I would like to use hook_form_block_admin_configure_alter to add configuration options to the blocks admin, but only if the block is for a View. It's important to add the settings here rather than in the view settings itself, since it will grouped with other additional block settings that are not Views specific.


2 Answers 2


As Clive said, each block will contain the module name from which it was created in the block configuration. For views blocks, it's views module.

This module information will be available in the form structure itself, like below:


So you don't need to query the database to retrieve it.

Pseudo code:

function my_module_form_block_admin_configure_alter(&$form, &$form_state) {
  if ($form['module']['#value'] == 'views') {
    // ...
  • 1
    Good call, that'll save an extra database hit
    – Clive
    Commented Jul 25, 2013 at 9:03

The module responsible for a block is listed as a column in the block table, so you can just do something like

$module = db_query('SELECT module FROM {block} WHERE bid = :bid', array(':bid' => $bid))->fetchField();
if ($module === 'views') {
  // ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.