EventGroup.php in Event 8
File
modules/event_group/src/Plugin/GroupContentEnabler/EventGroup.php
View source
<?php
namespace Drupal\event_group\Plugin\GroupContentEnabler;
use Drupal\group\Entity\GroupInterface;
use Drupal\group\Plugin\GroupContentEnablerBase;
use Drupal\event\Entity\EventType;
use Drupal\Core\Url;
use Drupal\Core\Form\FormStateInterface;
class EventGroup extends GroupContentEnablerBase {
public function getGroupOperations(GroupInterface $group) {
return [];
}
public function defaultConfiguration() {
$config = parent::defaultConfiguration();
$config['entity_cardinality'] = 1;
return $config;
}
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form = parent::buildConfigurationForm($form, $form_state);
$info = $this
->t("This field has been disabled by the plugin to guarantee the functionality that's expected of it.");
$form['entity_cardinality']['#disabled'] = TRUE;
$form['entity_cardinality']['#description'] .= '<br /><em>' . $info . '</em>';
return $form;
}
}