diff --git a/reserve.module b/reserve.module index e5d1d91..d7713b8 100644 --- a/reserve.module +++ b/reserve.module @@ -12,7 +12,6 @@ use Drupal\Core\Routing\RouteMatchInterface; use Drupal\Core\Entity\BundleEntityFormBase; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Form\FormStateInterface; -use Drupal\reserve\BundleFormAlter; define ('RESERVE_SAVE_CONFIRMATION_MSG', t('Configuration settings have been saved')); define ('RESERVE_RESET_CONFIRMATION_MSG', t('Configuration settings have been reset to their default values')); @@ -54,17 +53,6 @@ function reserve_help($route_name, RouteMatchInterface $route_match) { } } -/** - * Implements hook_form_alter(). - */ -function reserve_form_alter(array &$form, FormStateInterface $form_state, $form_id) { - if ($form_state->getFormObject() instanceof BundleEntityFormBase) { - (new BundleFormAlter($form_state->getFormObject()->getEntity())) - ->formAlter($form, $form_state); - } - return; -} - /** * Implements hook_entity_insert(). */ diff --git a/src/BundleFormAlter.php b/src/BundleFormAlter.php deleted file mode 100644 index 1a36d1a..0000000 --- a/src/BundleFormAlter.php +++ /dev/null @@ -1,113 +0,0 @@ -entity = $entity; - } - - /** - * This is a helper for og_ui_form_alter(). - * - * @param array $form - * The form variable. - * @param \Drupal\Core\Form\FormStateInterface $form_state - * The form state object. - */ - public function formAlter(array &$form, FormStateInterface $form_state) { - $this->prepare($form, $form_state); - $this->addReserveCategories($form, $form_state); - } - - /** - * Prepares object properties and adds the og details element. - * - * @param array $form - * The form variable. - * @param \Drupal\Core\Form\FormStateInterface $form_state - * The form state object. - */ - protected function prepare(array &$form, FormStateInterface $form_state) { - // Example: article. - $this->bundle = $this->entity->id(); - // Example: Article. - $this->bundleLabel = Unicode::lcfirst($this->entity->label()); - $this->definition = $this->entity->getEntityType(); - // Example: node. - $this->entityTypeId = $this->definition->getBundleOf(); - - $form['reserve'] = [ - '#type' => 'details', - '#title' => t('Reserve'), - '#collapsible' => TRUE, - '#group' => 'additional_settings', - '#description' => t('If any Reserve Categories are selected here; this bundle will be reservable.'), - ]; - } - - /** - * Adds the "is group?" checkbox. - */ - protected function addReserveCategories(array &$form, FormStateInterface $form_state) { - $options = array('big', 'small'); - $form['reserve']['reserve_categories'] = [ - '#type' => 'checkboxes', - '#title' => t('Categories'), - '#options' => array_combine($options, $options), - //'#default_value' => Og::isGroup($this->entityTypeId, $this->bundle), - - ]; - } - -}