function RulesEventHandlerEntityBundle::buildForm

Implements RulesEventHandlerInterface::buildForm().

Overrides RulesEventHandlerInterface::buildForm

File

includes/rules.event.inc, line 343

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;
}