Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
  2. $formats = explode(':', $this->getSetting('format'));
  3. $element += [
  4. '#type' => 'fieldset',
  5. '#attributes' => array('class' => ['container-inline', 'hms-field']),
  6. ];
  7.  
  8. foreach ($formats as $format) {
  9. $element[$format] = [
  10. '#default_value' => isset($items[$delta]->value) ? $items[$delta]->value : NULL,
  11. '#format' => $format,
  12. '#type' => 'hms',
  13. ];
  14. }
  15.  
  16. return array('value' => $element);
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement