RedhenContactFormBlock.php in RedHen CRM 8
File
modules/redhen_contact/src/Plugin/Block/RedhenContactFormBlock.php
View source
<?php
namespace Drupal\redhen_contact\Plugin\Block;
use Drupal\Core\Block\BlockBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\redhen_contact\Entity\ContactType;
class RedhenContactFormBlock extends BlockBase {
public function build() {
$build = [
'#markup' => '<p>FOOBAR</p>',
];
return $build;
}
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form = parent::buildConfigurationForm($form, $form_state);
$redhen_contact_types = ContactType::loadMultiple();
$form['redhen_contact_type'] = [
'#type' => 'select',
'#title' => $this
->t('Select element'),
'#options' => $redhen_contact_types,
];
return $form;
}
}