Commit a7e98179 authored by webchick's avatar webchick

Issue #1740470 follow-up by Wim Leers, larowlan, jibran: Clean-ups to phone field.

parent 1dab0e1c
......@@ -97,6 +97,7 @@ Drupal 8.0, xxxx-xx-xx (development version)
* Added language select form element in the Form API.
- Added E-mail field type to core.
- Added Link field type to core.
- Added Phone number field type to core.
- Added local image input filter, to enable secure image posting.
- Added Views and Views UI module to core.
......
......@@ -2,7 +2,7 @@
/**
* @file
* Definition of Drupal\telephone\Plugin\field\formatter\TelephoneLinkFormatter.
* Contains \Drupal\telephone\Plugin\field\formatter\TelephoneLinkFormatter.
*/
namespace Drupal\telephone\Plugin\field\formatter;
......@@ -30,7 +30,7 @@
class TelephoneLinkFormatter extends FormatterBase {
/**
* Implements Drupal\field\Plugin\Type\Formatter\FormatterInterface::settingsForm().
* Implements \Drupal\field\Plugin\Type\Formatter\FormatterInterface::settingsForm().
*/
public function settingsForm(array $form, array &$form_state) {
$elements['title'] = array(
......@@ -43,7 +43,7 @@ public function settingsForm(array $form, array &$form_state) {
}
/**
* Implements Drupal\field\Plugin\Type\Formatter\FormatterInterface::settingsSummary().
* Implements \Drupal\field\Plugin\Type\Formatter\FormatterInterface::settingsSummary().
*/
public function settingsSummary() {
$settings = $this->getSettings();
......@@ -59,7 +59,7 @@ public function settingsSummary() {
}
/**
* Implements Drupal\field\Plugin\Type\Formatter\FormatterInterface::prepareView().
* Implements \Drupal\field\Plugin\Type\Formatter\FormatterInterface::prepareView().
*/
public function prepareView(array $entities, $langcode, array &$items) {
$settings = $this->getSettings();
......@@ -74,19 +74,17 @@ public function prepareView(array $entities, $langcode, array &$items) {
else {
$item['title'] = $item['value'];
}
}
}
}
/**
* Implements Drupal\field\Plugin\Type\Formatter\FormatterInterface::viewElements().
* Implements \Drupal\field\Plugin\Type\Formatter\FormatterInterface::viewElements().
*/
public function viewElements(EntityInterface $entity, $langcode, array $items) {
$element = array();
foreach ($items as $delta => $item) {
// Prepend 'tel:' to the telephone number.
$href = 'tel:' . rawurlencode(preg_replace('/\s+/', '', $item['value']));
......@@ -97,8 +95,8 @@ public function viewElements(EntityInterface $entity, $langcode, array $items) {
'#href' => $href,
'#options' => array('external' => TRUE),
);
}
return $element;
}
}
......@@ -2,7 +2,7 @@
/**
* @file
* Definition of Drupal\telephone\Plugin\field\widget\TelephoneDefaultWidget.
* Contains \Drupal\telephone\Plugin\field\widget\TelephoneDefaultWidget.
*/
namespace Drupal\telephone\Plugin\field\widget;
......@@ -26,7 +26,7 @@
class TelephoneDefaultWidget extends WidgetBase {
/**
* Implements Drupal\field\Plugin\Type\Widget\WidgetInterface::formElement().
* Implements \Drupal\field\Plugin\Type\Widget\WidgetInterface::formElement().
*/
public function formElement(array $items, $delta, array $element, $langcode, array &$form, array &$form_state) {
$element['value'] = $element + array(
......
......@@ -2,7 +2,7 @@
/**
* @file
* Definition of Drupal\telephone\TelephoneFieldTest.
* Contains \Drupal\telephone\TelephoneFieldTest.
*/
namespace Drupal\telephone\Tests;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment