@@ -27,7 +27,7 @@ discard block |
||
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 |
||
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') |
@@ -92,8 +92,7 @@ |
||
92 | 92 | $replacement_nodes = Html::load($content)->getElementsByTagName('body') |
93 | 93 | ->item(0) |
94 | 94 | ->childNodes; |
95 | - } |
|
96 | - else { |
|
95 | + } else { |
|
97 | 96 | $replacement_nodes = [$node->ownerDocument->createTextNode('')]; |
98 | 97 | } |
99 | 98 |
@@ -54,8 +54,7 @@ |
||
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 | } |
@@ -43,7 +43,7 @@ |
||
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); |
@@ -61,7 +61,7 @@ |
||
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 | } |
@@ -77,7 +77,7 @@ |
||
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 | } |
@@ -138,26 +138,26 @@ discard block |
||
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 |
||
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 | } |
@@ -102,8 +102,7 @@ discard block |
||
102 | 102 | public function getTypeLabel() { |
103 | 103 | if ($definition = $this->embedTypeManager()->getDefinition($this->getTypeId(), FALSE)) { |
104 | 104 | return $definition['label']; |
105 | - } |
|
106 | - else { |
|
105 | + } else { |
|
107 | 106 | return $this->t('Unknown'); |
108 | 107 | } |
109 | 108 | } |
@@ -132,8 +131,7 @@ discard block |
||
132 | 131 | public function getIconUrl() { |
133 | 132 | if ($image = $this->getIconFile()) { |
134 | 133 | return file_create_url($image->getFileUri()); |
135 | - } |
|
136 | - else { |
|
134 | + } else { |
|
137 | 135 | return $this->getTypePlugin()->getDefaultIconUrl(); |
138 | 136 | } |
139 | 137 | } |
@@ -217,8 +215,7 @@ discard block |
||
217 | 215 | public function getTypeSetting($key, $default = NULL) { |
218 | 216 | if (isset($this->type_settings[$key])) { |
219 | 217 | return $this->type_settings[$key]; |
220 | - } |
|
221 | - else { |
|
218 | + } else { |
|
222 | 219 | return $default; |
223 | 220 | } |
224 | 221 | } |
@@ -43,8 +43,7 @@ |
||
43 | 43 | '#uri' => $icon_url, |
44 | 44 | '#alt' => $this->t('Icon for the @label button.', ['@label' => $entity->label()]), |
45 | 45 | ]; |
46 | - } |
|
47 | - else { |
|
46 | + } else { |
|
48 | 47 | $row['icon'] = $this->t('None'); |
49 | 48 | } |
50 | 49 |
@@ -130,7 +130,7 @@ |
||
130 | 130 | } |
131 | 131 | |
132 | 132 | $config = $this->config('embed.settings'); |
133 | - $upload_location = $config->get('file_scheme') . '://' . $config->get('upload_directory') . '/'; |
|
133 | + $upload_location = $config->get('file_scheme').'://'.$config->get('upload_directory').'/'; |
|
134 | 134 | $form['icon_file'] = [ |
135 | 135 | '#title' => $this->t('Button icon'), |
136 | 136 | '#type' => 'managed_file', |
@@ -122,8 +122,7 @@ discard block |
||
122 | 122 | if ($plugin = $button->getTypePlugin()) { |
123 | 123 | $form['type_settings'] = $plugin->buildConfigurationForm($form['type_settings'], $form_state); |
124 | 124 | } |
125 | - } |
|
126 | - catch (PluginNotFoundException $exception) { |
|
125 | + } catch (PluginNotFoundException $exception) { |
|
127 | 126 | drupal_set_message($exception->getMessage(), 'error'); |
128 | 127 | watchdog_exception('embed', $exception); |
129 | 128 | $form['type_id']['#disabled'] = FALSE; |
@@ -191,8 +190,7 @@ discard block |
||
191 | 190 | // in the config entity. |
192 | 191 | if (!empty($icon_fid) && $file = $this->entityTypeManager->getStorage('file')->load($icon_fid)) { |
193 | 192 | $button->set('icon_uuid', $file->uuid()); |
194 | - } |
|
195 | - else { |
|
193 | + } else { |
|
196 | 194 | $button->set('icon_uuid', NULL); |
197 | 195 | } |
198 | 196 | |
@@ -202,8 +200,7 @@ discard block |
||
202 | 200 | |
203 | 201 | if ($status == SAVED_UPDATED) { |
204 | 202 | drupal_set_message($this->t('The embed button %label has been updated.', $t_args)); |
205 | - } |
|
206 | - elseif ($status == SAVED_NEW) { |
|
203 | + } elseif ($status == SAVED_NEW) { |
|
207 | 204 | drupal_set_message($this->t('The embed button %label has been added.', $t_args)); |
208 | 205 | $context = array_merge($t_args, ['link' => $button->link($this->t('View'), 'collection')]); |
209 | 206 | $this->logger('embed')->notice('Added embed button %label.', $context); |