WebformElement.php in Webform 6.x
File
src/Plugin/WebformElement/WebformElement.php
View source
<?php
namespace Drupal\webform\Plugin\WebformElement;
use Drupal\Core\Form\FormStateInterface;
use Drupal\webform\Plugin\WebformElementBase;
class WebformElement extends WebformElementBase {
protected function defineDefaultProperties() {
return [];
}
public function isInput(array $element) {
return !empty($element['#type']) && !in_array($element['#type'], [
'submit',
]) ? TRUE : FALSE;
}
public function preview() {
return [];
}
public function form(array $form, FormStateInterface $form_state) {
$form['element'] = [
'#type' => 'details',
'#title' => $this
->t('General settings'),
'#open' => TRUE,
];
return $form;
}
public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
$form = parent::buildConfigurationForm($form, $form_state);
$form['custom']['#type'] = 'fieldset';
$form['custom']['#title'] = $this
->t('Element settings');
$form['custom']['#weight'] = 100;
$form['custom']['custom']['#title'] = $this
->t('Properties');
return $form;
}
protected function buildConfigurationFormTabs(array $form, FormStateInterface $form_state) {
return $form;
}
public function getElementSelectorOptions(array $element) {
return [];
}
}