Skip to content
Snippets Groups Projects
Commit 206ecced authored by Nathan Weir's avatar Nathan Weir Committed by neffets
Browse files

Issue #3129802 by natew: Undefined index errors throughout

parent e84e17ba
No related branches found
Tags 8.x-2.6
No related merge requests found
......@@ -58,7 +58,7 @@ class IframeWidgetBase extends WidgetBase {
'#type' => 'textfield',
'#title' => $this->t('Iframe Width'),
// ''
'#default_value' => $values['width'],
'#default_value' => isset($values['width']) ? $values['width'] : '',
'#description' => self::getSizedescription(),
'#maxlength' => 4,
'#size' => 4,
......@@ -67,7 +67,7 @@ class IframeWidgetBase extends WidgetBase {
'#type' => 'textfield',
'#title' => $this->t('Iframe Height'),
// ''
'#default_value' => $values['height'],
'#default_value' => isset($values['height']) ? $values['height'] : '',
'#description' => self::getSizedescription(),
'#maxlength' => 4,
'#size' => 4,
......@@ -76,14 +76,14 @@ class IframeWidgetBase extends WidgetBase {
'#type' => 'textfield',
'#title' => $this->t('Additional CSS Class'),
// ''
'#default_value' => $values['class'],
'#default_value' => isset($values['class']) ? $values['class'] : '',
'#description' => $this->t('When output, this iframe will have this class attribute. Multiple classes should be separated by spaces.'),
];
$element['expose_class'] = [
'#type' => 'checkbox',
'#title' => $this->t('Expose Additional CSS Class'),
// 0
'#default_value' => $values['expose_class'],
'#default_value' => isset($values['expose_class']) ? $values['expose_class'] : '',
'#description' => $this->t('Allow author to specify an additional class attribute for this iframe.'),
];
$element['frameborder'] = [
......@@ -91,7 +91,7 @@ class IframeWidgetBase extends WidgetBase {
'#title' => $this->t('Frameborder'),
'#options' => ['0' => $this->t('No frameborder'), '1' => $this->t('Show frameborder')],
// 0
'#default_value' => $values['frameborder'],
'#default_value' => isset($values['frameborder']) ? $values['frameborder'] : '0',
'#description' => $this->t('Frameborder is the border around the iframe. Most people want it removed, so the default value for frameborder is zero (0), or no border.'),
];
$element['scrolling'] = [
......@@ -103,7 +103,7 @@ class IframeWidgetBase extends WidgetBase {
'yes' => $this->t('Enabled'),
],
// 'auto'
'#default_value' => $values['scrolling'],
'#default_value' => isset($values['scrolling']) ? $values['scrolling'] : 'auto',
'#description' => $this->t('Scrollbars help the user to reach all iframe content despite the real height of the iframe content. Please disable it only if you know what you are doing.'),
];
$element['transparency'] = [
......@@ -114,7 +114,7 @@ class IframeWidgetBase extends WidgetBase {
'1' => $this->t('Allow transparency'),
],
// 0
'#default_value' => $values['transparency'],
'#default_value' => isset($values['transparency']) ? $values['transparency'] : '0',
'#description' => $this->t('Allow transparency per CSS in the outer iframe tag. You have to set background-color:transparent in your iframe body tag too!'),
];
$element['tokensupport'] = [
......@@ -126,7 +126,7 @@ class IframeWidgetBase extends WidgetBase {
'2' => $this->t('Tokens for title and URL field'),
],
// 0
'#default_value' => $values['tokensupport'],
'#default_value' => isset($values['tokensupport']) ? $values['tokensupport'] : '0',
'#description' => $this->t('Are tokens allowed for users to use in title or URL field?'),
];
$element['allowfullscreen'] = [
......@@ -137,7 +137,7 @@ class IframeWidgetBase extends WidgetBase {
'1' => $this->t('true'),
],
// 0
'#default_value' => $values['allowfullscreen'],
'#default_value' => isset($values['allowfullscreen']) ? $values['allowfullscreen'] : '0',
'#description' => $this->t('Allow fullscreen for iframe. The iframe can activate fullscreen mode by calling the requestFullscreen() method.'),
];
......@@ -177,7 +177,7 @@ class IframeWidgetBase extends WidgetBase {
// 2) Edit-fields on the article-edit-page (on_admin_page = false).
// Global settings.
$field_settings = $this->getFieldSettings();
$settings = $this->getSettings() + $field_settings;
$settings = $this->getSettings() + $field_settings + self::defaultSettings();
/** @var \Drupal\iframe\Plugin\Field\FieldType\IframeItem $item */
$item =& $items[$delta];
$field_definition = $item->getFieldDefinition();
......@@ -195,7 +195,7 @@ class IframeWidgetBase extends WidgetBase {
}
}
else {
if ($settings['expose_class']) {
if (isset($settings['expose_class']) && $settings['expose_class']) {
$this->allowedAttributes['class'] = 1;
}
foreach ($this->allowedAttributes as $attribute => $attrAllowed) {
......@@ -238,7 +238,7 @@ class IframeWidgetBase extends WidgetBase {
'#type' => 'textfield',
'#title' => $this->t('Iframe URL'),
'#placeholder' => 'https://',
'#default_value' => $settings['url'],
'#default_value' => isset($settings['url']) ? $settings['url'] : '',
'#size' => 80,
'#maxlength' => 1024,
'#weight' => 1,
......@@ -248,7 +248,7 @@ class IframeWidgetBase extends WidgetBase {
$element['width'] = [
'#title' => $this->t('Iframe Width'),
'#type' => 'textfield',
'#default_value' => $settings['width'],
'#default_value' => isset($settings['width']) ? $settings['width'] : '',
'#description' => self::getSizedescription(),
'#maxlength' => 4,
'#size' => 4,
......@@ -258,7 +258,7 @@ class IframeWidgetBase extends WidgetBase {
$element['height'] = [
'#type' => 'textfield',
'#title' => $this->t('Iframe Height'),
'#default_value' => $settings['height'],
'#default_value' => isset($settings['height']) ? $settings['height'] : '',
'#description' => self::getSizedescription(),
'#maxlength' => 4,
'#size' => 4,
......
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