You are here

public function Instance::setWidget in Little helpers 7

Same name and namespace in other branches
  1. 7.2 src/Field/Instance.php \Drupal\little_helpers\Field\Instance::setWidget()

Set widget type and update defaults accordingly.

See also

_field_write_instance()

1 call to Instance::setWidget()
Instance::setField in src/Field/Instance.php
Set field and update default values accordingly.

File

src/Field/Instance.php, line 97

Class

Instance

Namespace

Drupal\little_helpers\Field

Code

public function setWidget($widget_type_name, $settings = array()) {
  $this->widget['type'] = $widget_type_name;
  $this->widget['settings'] = $settings;
  $widget_type = \field_info_widget_types($widget_type_name);
  $this->widget['module'] = $widget_type['module'];
  $this->widget['settings'] += \field_info_widget_settings($widget_type_name);
}