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"), * label = @Translation("Entity Bundle"),
* context = { * context = {
* "node" = @ContextDefinition("entity:node", required = FALSE, label = @Translation("Node")), * "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")) * "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) { public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$options = []; $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); $bundles = \Drupal::service('entity_type.bundle.info')->getBundleInfo($content_entity);
foreach ($bundles as $bundle => $bundle_properties) { foreach ($bundles as $bundle => $bundle_properties) {
$options[$bundle] = $this->t('@bundle (@type)', [ $options[$bundle] = $this->t('@bundle (@type)', [

Loading…
Cancel
Save