You are here

public function RulesEventHandlerEntityBundle::buildForm in Rules 7.2

Implements RulesEventHandlerInterface::buildForm().

Overrides RulesEventHandlerInterface::buildForm

File

includes/rules.event.inc, line 343
Contains event handler interface and base classes.

Class

RulesEventHandlerEntityBundle
Exposes the bundle of an entity as event setting.

Code

public function buildForm(array &$form_state) {
  $form['bundle'] = array(
    '#type' => 'select',
    '#title' => t('Restrict by @bundle', array(
      '@bundle' => $this
        ->getBundlePropertyLabel(),
    )),
    '#description' => t('If you need to filter for multiple values, either add multiple events or use the "Entity is of bundle" condition instead.'),
    '#default_value' => $this->settings['bundle'],
    '#empty_value' => '',
    '#options' => array(),
  );
  foreach ($this->entityInfo['bundles'] as $name => $bundle_info) {
    $form['bundle']['#options'][$name] = $bundle_info['label'];
  }
  return $form;
}