Skip to content
Snippets Groups Projects
Commit cda128d8 authored by Hardik Pandya's avatar Hardik Pandya Committed by Oleksandr Lunov
Browse files

Issue #3341185: Drupal Coding Standards Issues | phpcs

parent 297251db
No related branches found
No related tags found
1 merge request!1Issue #3341185: Drupal Coding Standards Issues | phpcs
......@@ -5,7 +5,7 @@ namespace Drupal\enhanced_button_link;
use Drupal\Component\Utility\Html;
/**
* Class EnhancedButtonLinkHelper.
* The helper class to handle configuration for the field widget and formatter.
*/
class EnhancedButtonLinkHelper {
......@@ -31,7 +31,7 @@ class EnhancedButtonLinkHelper {
}
// Parse and check style options pairs.
list($raw_css_class, $raw_name) = explode('|', trim($line), 2);
[$raw_css_class, $raw_name] = explode('|', trim($line), 2);
$raw_css_class = trim($raw_css_class);
$raw_name = trim($raw_name);
......
......@@ -2,9 +2,7 @@
namespace Drupal\enhanced_button_link;
use Exception;
/**
* Class EnhancedButtonLinkParseException.
* Defines an exception thrown when parsing operations fail.
*/
class EnhancedButtonLinkParseException extends Exception {}
class EnhancedButtonLinkParseException extends \Exception {}
......@@ -89,7 +89,7 @@ class EnhancedButtonLinkWidget extends LinkWidget {
$element['options']['type'] = [
'#type' => 'select',
'#title' => $this->t('Type'),
'#default_value' => isset($items[$delta]->options['type']) ? $items[$delta]->options['type'] : EnhancedButtonLinkInterface::TYPE_DEFAULT,
'#default_value' => $items[$delta]->options['type'] ?? EnhancedButtonLinkInterface::TYPE_DEFAULT,
'#description' => $this->t('Select the type of the button.'),
'#options' => [
EnhancedButtonLinkInterface::TYPE_DEFAULT => $this->t('Default'),
......@@ -100,7 +100,7 @@ class EnhancedButtonLinkWidget extends LinkWidget {
$element['options']['size'] = [
'#type' => 'select',
'#title' => $this->t('Size'),
'#default_value' => isset($items[$delta]->options['size']) ? $items[$delta]->options['size'] : EnhancedButtonLinkInterface::SIZE_DEFAULT,
'#default_value' => $items[$delta]->options['size'] ?? EnhancedButtonLinkInterface::SIZE_DEFAULT,
'#description' => $this->t('Select the size of the button.'),
'#options' => [
EnhancedButtonLinkInterface::SIZE_DEFAULT => $this->t('Default'),
......@@ -114,7 +114,7 @@ class EnhancedButtonLinkWidget extends LinkWidget {
$element['options']['status'] = [
'#type' => 'select',
'#title' => $this->t('Status'),
'#default_value' => isset($items[$delta]->options['status']) ? $items[$delta]->options['status'] : EnhancedButtonLinkInterface::STATUS_DEFAULT,
'#default_value' => $items[$delta]->options['status'] ?? EnhancedButtonLinkInterface::STATUS_DEFAULT,
'#description' => $this->t('Select the status of the button.'),
'#options' => [
EnhancedButtonLinkInterface::STATUS_DEFAULT => $this->t('Default'),
......@@ -127,7 +127,7 @@ class EnhancedButtonLinkWidget extends LinkWidget {
$element['options']['target'] = [
'#type' => 'select',
'#title' => $this->t('Target'),
'#default_value' => isset($items[$delta]->options['target']) ? $items[$delta]->options['target'] : EnhancedButtonLinkInterface::TARGET_DEFAULT,
'#default_value' => $items[$delta]->options['target'] ?? EnhancedButtonLinkInterface::TARGET_DEFAULT,
'#description' => $this->t('Select the link target.'),
'#options' => [
EnhancedButtonLinkInterface::TARGET_DEFAULT => $this->t('Default'),
......
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