@@ -99,8 +99,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -44,8 +44,7 @@ |
||
| 44 | 44 | '#uri' => $icon_url, |
| 45 | 45 | '#alt' => $this->t('Button icon for the @label button', ['@label' => $entity->label()]), |
| 46 | 46 | ]; |
| 47 | - } |
|
| 48 | - else { |
|
| 47 | + } else { |
|
| 49 | 48 | $row['icon'] = $this->t('None'); |
| 50 | 49 | } |
| 51 | 50 | |
@@ -143,7 +143,7 @@ |
||
| 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', |
@@ -135,8 +135,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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); |
@@ -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 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 | |
@@ -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 | } |