3 namespace Drupal\drupalmoduleupgrader\Plugin\DMU\Converter;
5 use Drupal\drupalmoduleupgrader\ConverterBase;
6 use Drupal\drupalmoduleupgrader\TargetInterface;
7 use Drupal\drupalmoduleupgrader\Utility\StringTransformTrait;
11 * id = "hook_field_widget_info",
12 * description = @Translation("Creates formatter class templates from hook_field_widget_info()."),
13 * hook = "hook_field_widget_info"
16 class HookFieldWidgetInfo extends ConverterBase {
18 use StringTransformTrait;
23 public function convert(TargetInterface $target) {
25 $widgets = $this->executeHook($target, $this->pluginDefinition['hook']);
27 catch (\LogicException $e) {
28 $this->logger->warning($e->getMessage(), [
29 'target' => $target->id(),
30 'hook' => $this->pluginDefinition['hook'],
35 foreach ($widgets as $id => $widget) {
37 '#module' => $target->id(),
38 '#class' => $this->toTitleCase($id),
39 '#theme' => 'dmu_widget',
42 'label' => $widget['label'],
43 'description' => $widget['description'] ?: NULL,
44 'field_types' => $widget['field types'],
47 $this->writeClass($target, $this->parse($render));