Skip to content
Snippets Groups Projects
Commit a7e98179 authored by Angie Byron's avatar Angie Byron
Browse files

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

parent 1dab0e1c
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment