$query = new EntityFieldQuery();
  $query->entityCondition('entity_type', 'node')
          ->entityCondition('bundle', 'webform');
  $result = $query->execute();
  $options = array(
      0 => 'None'
  );
  if (!empty($result['node'])) {
      $nids = array_keys($result['node']);
      $nodes = node_load_multiple($nids);
      foreach ($nodes as $nid => $node) {
        $options[$nid] = $node->label();
      }
  }  
  return $options;

I use the above code to retrieve nodes that are webforms.
What I would like to know is what condition to use to get only the webforms that have the block functionality?

Accepted answer

The actual query would look like this (untested): 

$query = db_select('node');
$query->addField('node', 'nid'); 
$query->condition('node.type', 'webform'); 
$query->join('webform', 'webform', 'node.nid = webform.nid'); 
$query->condition('webform.block', TRUE); 
$results = $query->execute()->fetchCol();

That will fetch an array of node IDs.

Comments

Two routes to do this:

  1. Load all webform nodes (as you are doing) and then loop through the array of nodes and check if $node->webform['block'] is TRUE. If not, remove the node from the array. This is a bit less efficient but it's easier to implement
  2. If you want to do this with a database query, you have to do a query join to the table webform using the nids, and add a condition for the column block to be TRUE. Unfortunately you can't use EntityFieldQuery to do this, since you can't do joins with that. You must use db_select('node') or db_query() by writing the actual sql query. See documentation for both.

Number 2 is more efficient as the selection happens at the query level. 

The actual query would look like this (untested): 

$query = db_select('node');
$query->addField('node', 'nid'); 
$query->condition('node.type', 'webform'); 
$query->join('webform', 'webform', 'node.nid = webform.nid'); 
$query->condition('webform.block', TRUE); 
$results = $query->execute()->fetchCol();

That will fetch an array of node IDs.

Thanks @argiepiano, that did the trick!

For anyone else trying to build a form that enables selection of webforms with block capability, this is the answer:

//return array of webforms for a Select input, that have the Advanced->Block checked, because then we can inject them into other content
$query = db_select('node');
$query->addField('node', 'nid'); 
$query->condition('node.type', 'webform'); 
$query->join('webform', 'webform', 'node.nid = webform.nid'); 
$query->condition('webform.block', TRUE); 
$result = $query->execute()->fetchCol();
  $options = array(
      0 => t('None')
  ); //have a default None at the front of the array for the choosing.  
  if (!empty($result)) { 
      $nodes = node_load_multiple($result);
      foreach ($nodes as $nid => $node) {
        $options[$nid] = $node->label();
      }
  }  
  return $options;