You are here

IpAddressDefaultWidget.php in IP address fields 8

Same filename and directory in other branches
  1. 2.0.x src/Plugin/Field/FieldWidget/IpAddressDefaultWidget.php

File

src/Plugin/Field/FieldWidget/IpAddressDefaultWidget.php
View source
<?php

namespace Drupal\field_ipaddress\Plugin\Field\FieldWidget;

use Drupal\Core\Field\FieldItemListInterface;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
 * Plugin implementation of the 'datetime_default' widget.
 *
 * @FieldWidget(
 *   id = "ipaddress_default",
 *   label = @Translation("IP address default"),
 *   field_types = {
 *     "ipaddress"
 *   }
 * )
 */
class IpAddressDefaultWidget extends IpAddressWidgetBase implements ContainerFactoryPluginInterface {

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
    return new static($plugin_id, $plugin_definition, $configuration['field_definition'], $configuration['settings'], $configuration['third_party_settings']);
  }

  /**
   * {@inheritdoc}
   */
  public function formElement(FieldItemListInterface $items, $delta, array $element, array &$form, FormStateInterface $form_state) {
    $element = parent::formElement($items, $delta, $element, $form, $form_state);
    return $element;
  }

}

Classes

Namesort descending Description
IpAddressDefaultWidget Plugin implementation of the 'datetime_default' widget.