Completed
Pull Request — 8.x-1.x (#24)
by Dave
02:20
created
src/Entity/EmbedButton.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -99,8 +99,7 @@  discard block
 block discarded – undo
99 99
   public function getTypeLabel() {
100 100
     if ($definition = $this->embedTypeManager()->getDefinition($this->getTypeId(), FALSE)) {
101 101
       return $definition['label'];
102
-    }
103
-    else {
102
+    } else {
104 103
       return t('Unknown');
105 104
     }
106 105
   }
@@ -129,8 +128,7 @@  discard block
 block discarded – undo
129 128
   public function getIconUrl() {
130 129
     if ($image = $this->getIconFile()) {
131 130
       return $image->url();
132
-    }
133
-    else {
131
+    } else {
134 132
       return $this->getTypePlugin()->getDefaultIconUrl();
135 133
     }
136 134
   }
@@ -213,8 +211,7 @@  discard block
 block discarded – undo
213 211
   public function getTypeSetting($key, $default = NULL) {
214 212
     if (isset($this->type_settings[$key])) {
215 213
       return $this->type_settings[$key];
216
-    }
217
-    else {
214
+    } else {
218 215
       return $default;
219 216
     }
220 217
   }
Please login to merge, or discard this patch.
src/Form/EmbedButtonForm.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -143,7 +143,7 @@
 block discarded – undo
143 143
     }
144 144
 
145 145
     $config = $this->config('embed.settings');
146
-    $upload_location = $config->get('file_scheme') . '://' . $config->get('upload_directory') . '/';
146
+    $upload_location = $config->get('file_scheme').'://'.$config->get('upload_directory').'/';
147 147
     $form['icon_file'] = array(
148 148
       '#title' => $this->t('Button icon image'),
149 149
       '#type' => 'managed_file',
Please login to merge, or discard this patch.
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -135,8 +135,7 @@  discard block
 block discarded – undo
135 135
       if ($plugin = $button->getTypePlugin()) {
136 136
         $form['type_settings'] = $plugin->buildConfigurationForm($form['type_settings'], $form_state);
137 137
       }
138
-    }
139
-    catch (PluginNotFoundException $exception) {
138
+    } catch (PluginNotFoundException $exception) {
140 139
       drupal_set_message($exception->getMessage(), 'error');
141 140
       watchdog_exception('embed', $exception);
142 141
       $form['type_id']['#disabled'] = FALSE;
@@ -215,8 +214,7 @@  discard block
 block discarded – undo
215 214
     // in the config entity.
216 215
     if (!empty($icon_fid) && $file = $this->entityManager->getStorage('file')->load($icon_fid)) {
217 216
       $button->set('icon_uuid', $file->uuid());
218
-    }
219
-    else {
217
+    } else {
220 218
       $button->set('icon_uuid', NULL);
221 219
     }
222 220
 
@@ -226,8 +224,7 @@  discard block
 block discarded – undo
226 224
 
227 225
     if ($status == SAVED_UPDATED) {
228 226
       drupal_set_message(t('The embed button %label has been updated.', $t_args));
229
-    }
230
-    elseif ($status == SAVED_NEW) {
227
+    } elseif ($status == SAVED_NEW) {
231 228
       drupal_set_message(t('The embed button %label has been added.', $t_args));
232 229
       $context = array_merge($t_args, array('link' => $button->link($this->t('View'), 'collection')));
233 230
       $this->logger('embed')->notice('Added embed button %label.', $context);
Please login to merge, or discard this patch.
src/DomHelperTrait.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
    * @param string $name
28 28
    *   The new tag name.
29 29
    */
30
-  protected function changeNodeName(\DOMNode &$node, $name = 'div') {
30
+  protected function changeNodeName(\DOMNode&$node, $name = 'div') {
31 31
     if ($node->nodeName != $name) {
32 32
       /** @var \DOMElement $replacement_node */
33 33
       $replacement_node = $node->ownerDocument->createElement($name);
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
    * @param string $content
87 87
    *   The text or HTML that will replace the contents of $node.
88 88
    */
89
-  protected function replaceNodeContent(\DOMNode &$node, $content) {
89
+  protected function replaceNodeContent(\DOMNode&$node, $content) {
90 90
     if (strlen($content)) {
91 91
       // Load the content into a new DOMDocument and retrieve the DOM nodes.
92 92
       $replacement_nodes = Html::load($content)->getElementsByTagName('body')
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,8 +54,7 @@
 block discarded – undo
54 54
     $configuration = $this->getConfiguration();
55 55
     if (array_key_exists($name, $configuration)) {
56 56
       return $configuration[$name];
57
-    }
58
-    else {
57
+    } else {
59 58
       return $default;
60 59
     }
61 60
   }
Please login to merge, or discard this patch.
src/EmbedType/EmbedTypeBase.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -54,8 +54,7 @@
 block discarded – undo
54 54
     $configuration = $this->getConfiguration();
55 55
     if (array_key_exists($name, $configuration)) {
56 56
       return $configuration[$name];
57
-    }
58
-    else {
57
+    } else {
59 58
       return $default;
60 59
     }
61 60
   }
Please login to merge, or discard this patch.
src/EmbedType/EmbedTypeManager.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
    *   An array of valid plugin labels, keyed by plugin ID.
44 44
    */
45 45
   public function getDefinitionOptions() {
46
-    $options = array_map(function ($definition) {
46
+    $options = array_map(function($definition) {
47 47
       return (string) $definition['label'];
48 48
     }, $this->getDefinitions());
49 49
     natsort($options);
Please login to merge, or discard this patch.
src/Tests/PreviewTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@
 block discarded – undo
61 61
    *   The retrieved HTML string.
62 62
    */
63 63
   public function getRoute($filter_format_id, $value = NULL) {
64
-    $url = 'embed/preview/' . $filter_format_id;
64
+    $url = 'embed/preview/'.$filter_format_id;
65 65
     if (!isset($value)) {
66 66
       $value = static::SUCCESS;
67 67
     }
Please login to merge, or discard this patch.
src/Tests/EmbedButtonAdminTest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
     $this->assertText($button_label, 'Test embed_button appears on the list page');
42 42
 
43 43
     // Edit embed button.
44
-    $this->drupalGet('admin/config/content/embed/button/manage/' . $button_id);
44
+    $this->drupalGet('admin/config/content/embed/button/manage/'.$button_id);
45 45
     $new_button_label = $this->randomMachineName();
46 46
     $edit = array(
47 47
       'label' => $new_button_label,
@@ -53,10 +53,10 @@  discard block
 block discarded – undo
53 53
     $this->assertNoText($button_label, 'Old label does not appears on the list page');
54 54
 
55 55
     // Delete embed button.
56
-    $this->drupalGet('admin/config/content/embed/button/manage/' . $button_id . '/delete');
56
+    $this->drupalGet('admin/config/content/embed/button/manage/'.$button_id.'/delete');
57 57
     $this->drupalPostForm(NULL, array(), 'Delete');
58 58
     // Ensure that the deleted embed button no longer exists.
59
-    $this->drupalGet('admin/config/content/embed/button/manage/' . $button_id);
59
+    $this->drupalGet('admin/config/content/embed/button/manage/'.$button_id);
60 60
     $this->assertResponse(404, 'Deleted embed button no longer exists.');
61 61
     // Ensure that the deleted button is no longer listed.
62 62
     $this->drupalGet('admin/config/content/embed');
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
     $this->drupalPostForm(NULL, $edit, 'Save');
83 83
     $this->assertText('Helicopters are just rotorcraft.');
84 84
 
85
-    $this->drupalGet('admin/config/content/embed/button/manage/' . $button_id);
85
+    $this->drupalGet('admin/config/content/embed/button/manage/'.$button_id);
86 86
     $this->assertFieldByName('type_settings[aircraft_type]', 'rotorcraft');
87 87
   }
88 88
 
Please login to merge, or discard this patch.
src/Tests/EmbedButtonEditorAccessCheckTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@
 block discarded – undo
77 77
    *   The retrieved HTML string.
78 78
    */
79 79
   public function getRoute($editor_id, $embed_button_id, $value = NULL) {
80
-    $url = 'embed-test/access/' . $editor_id . '/' . $embed_button_id;
80
+    $url = 'embed-test/access/'.$editor_id.'/'.$embed_button_id;
81 81
     if (!isset($value)) {
82 82
       $value = static::SUCCESS;
83 83
     }
Please login to merge, or discard this patch.
src/Tests/EmbedTestBase.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -138,26 +138,26 @@  discard block
 block discarded – undo
138 138
           $wrapperNode = NULL;
139 139
           // When a command specifies a specific selector, use it.
140 140
           if (!empty($command['selector']) && strpos($command['selector'], '#') === 0) {
141
-            $wrapperNode = $xpath->query('//*[@id="' . substr($command['selector'], 1) . '"]')->item(0);
141
+            $wrapperNode = $xpath->query('//*[@id="'.substr($command['selector'], 1).'"]')->item(0);
142 142
           }
143 143
           // When a command doesn't specify a selector, use the
144 144
           // #ajax['wrapper'] which is always an HTML ID.
145 145
           elseif (!empty($ajax_settings['wrapper'])) {
146
-            $wrapperNode = $xpath->query('//*[@id="' . $ajax_settings['wrapper'] . '"]')->item(0);
146
+            $wrapperNode = $xpath->query('//*[@id="'.$ajax_settings['wrapper'].'"]')->item(0);
147 147
           }
148 148
           // @todo Ajax commands can target any jQuery selector, but these are
149 149
           //   hard to fully emulate with XPath. For now, just handle 'head'
150 150
           //   and 'body', since these are used by
151 151
           //   \Drupal\Core\Ajax\AjaxResponse::ajaxRender().
152 152
           elseif (in_array($command['selector'], array('head', 'body'))) {
153
-            $wrapperNode = $xpath->query('//' . $command['selector'])->item(0);
153
+            $wrapperNode = $xpath->query('//'.$command['selector'])->item(0);
154 154
           }
155 155
           if ($wrapperNode) {
156 156
             // ajax.js adds an enclosing DIV to work around a Safari bug.
157 157
             $newDom = new \DOMDocument();
158 158
             // DOM can load HTML soup. But, HTML soup can throw warnings,
159 159
             // suppress them.
160
-            @$newDom->loadHTML('<div>' . $command['data'] . '</div>');
160
+            @$newDom->loadHTML('<div>'.$command['data'].'</div>');
161 161
             // Suppress warnings thrown when duplicate HTML IDs are encountered.
162 162
             // This probably means we are replacing an element with the same ID.
163 163
             $newNode = @$dom->importNode($newDom->documentElement->firstChild->firstChild, TRUE);
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
         case 'add_css':
210 210
           break;
211 211
         case 'update_build_id':
212
-          $buildId = $xpath->query('//input[@name="form_build_id" and @value="' . $command['old'] . '"]')->item(0);
212
+          $buildId = $xpath->query('//input[@name="form_build_id" and @value="'.$command['old'].'"]')->item(0);
213 213
           if ($buildId) {
214 214
             $buildId->setAttribute('value', $command['new']);
215 215
           }
Please login to merge, or discard this patch.