Browse Source

Adding media to the EntityBundle condition (#123)

pull/729/head
dannylamb 6 years ago committed by Seth Shaw
parent
commit
a209d3c1ca
  1. 3
      src/Plugin/Condition/EntityBundle.php

3
src/Plugin/Condition/EntityBundle.php

@ -13,6 +13,7 @@ use Drupal\Core\Form\FormStateInterface;
* label = @Translation("Entity Bundle"),
* context = {
* "node" = @ContextDefinition("entity:node", required = FALSE, label = @Translation("Node")),
* "media" = @ContextDefinition("entity:media", required = FALSE, label = @Translation("Media")),
* "taxonomy_term" = @ContextDefinition("entity:taxonomy_term", required = FALSE, label = @Translation("Term"))
* }
* )
@ -24,7 +25,7 @@ class EntityBundle extends ConditionPluginBase {
*/
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$options = [];
foreach (['node', 'taxonomy_term'] as $content_entity) {
foreach (['node', 'media', 'taxonomy_term'] as $content_entity) {
$bundles = \Drupal::service('entity_type.bundle.info')->getBundleInfo($content_entity);
foreach ($bundles as $bundle => $bundle_properties) {
$options[$bundle] = $this->t('@bundle (@type)', [

Loading…
Cancel
Save