function NodeType::buildConfigurationForm

Same name in other branches
  1. 9 core/modules/node/src/Plugin/Condition/NodeType.php \Drupal\node\Plugin\Condition\NodeType::buildConfigurationForm()

Overrides ConditionPluginBase::buildConfigurationForm

File

core/modules/node/src/Plugin/Condition/NodeType.php, line 66

Class

NodeType
Provides a 'Node Type' condition.

Namespace

Drupal\node\Plugin\Condition

Code

public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
    $options = [];
    $node_types = $this->entityStorage
        ->loadMultiple();
    foreach ($node_types as $type) {
        $options[$type->id()] = $type->label();
    }
    $form['bundles'] = [
        '#title' => $this->t('Node types'),
        '#type' => 'checkboxes',
        '#options' => $options,
        '#default_value' => $this->configuration['bundles'],
    ];
    return parent::buildConfigurationForm($form, $form_state);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.