@@ -62,7 +62,7 @@ |
||
62 | 62 | /** @var $browser \Drupal\entity_browser\EntityBrowserInterface */ |
63 | 63 | $browser = $this->browserStorage->load($id); |
64 | 64 | if ($route = $browser->route()) { |
65 | - $collection->add('entity_browser.' . $browser->id(), $route); |
|
65 | + $collection->add('entity_browser.'.$browser->id(), $route); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 |
@@ -30,7 +30,7 @@ |
||
30 | 30 | * @return array |
31 | 31 | * Form structure. |
32 | 32 | */ |
33 | - public function getForm(array &$form, FormStateInterface &$form_state); |
|
33 | + public function getForm(array &$form, FormStateInterface&$form_state); |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * Sets the default widget. |
@@ -125,7 +125,7 @@ |
||
125 | 125 | $files = $this->prepareEntities($form, $form_state); |
126 | 126 | array_walk( |
127 | 127 | $files, |
128 | - function (FileInterface $file) { |
|
128 | + function(FileInterface $file) { |
|
129 | 129 | $file->setPermanent(); |
130 | 130 | $file->save(); |
131 | 131 | } |
@@ -43,12 +43,12 @@ |
||
43 | 43 | // Return the form as a modal dialog. |
44 | 44 | $form['#attached']['library'][] = 'core/drupal.dialog.ajax'; |
45 | 45 | $title = $this->t('Edit entity @entity', ['@entity' => $entity->label()]); |
46 | - $response = AjaxResponse::create()->addCommand(new OpenDialogCommand('#' . $entity->getEntityTypeId() . '-' . $entity->id() . '-edit-dialog', $title, $form, ['modal' => TRUE, 'width' => 800])); |
|
46 | + $response = AjaxResponse::create()->addCommand(new OpenDialogCommand('#'.$entity->getEntityTypeId().'-'.$entity->id().'-edit-dialog', $title, $form, ['modal' => TRUE, 'width' => 800])); |
|
47 | 47 | return $response; |
48 | 48 | } |
49 | 49 | else { |
50 | 50 | // Return command for closing the modal. |
51 | - $response = AjaxResponse::create()->addCommand(new CloseDialogCommand('#' . $entity->getEntityTypeId() . '-' . $entity->id() . '-edit-dialog')); |
|
51 | + $response = AjaxResponse::create()->addCommand(new CloseDialogCommand('#'.$entity->getEntityTypeId().'-'.$entity->id().'-edit-dialog')); |
|
52 | 52 | // Also refresh the widget if "details_id" is provided. |
53 | 53 | $details_id = $request->query->get('details_id'); |
54 | 54 | if (!empty($details_id)) { |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | /** |
19 | 19 | * Implements hook_inline_entity_form_reference_form_alter(). |
20 | 20 | */ |
21 | -function entity_browser_entity_form_inline_entity_form_reference_form_alter(&$reference_form, FormStateInterface &$form_state) { |
|
21 | +function entity_browser_entity_form_inline_entity_form_reference_form_alter(&$reference_form, FormStateInterface&$form_state) { |
|
22 | 22 | /** @var \Drupal\field\FieldConfigInterface $instance */ |
23 | 23 | $instance = $form_state->get([ |
24 | 24 | 'inline_entity_form', |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | ]); |
28 | 28 | |
29 | 29 | /** @var \Drupal\Core\Entity\Display\EntityFormDisplayInterface $form_display */ |
30 | - $entity_form_id = $instance->getTargetEntityTypeId() . '.' . $instance->getTargetBundle() . '.default'; |
|
30 | + $entity_form_id = $instance->getTargetEntityTypeId().'.'.$instance->getTargetBundle().'.default'; |
|
31 | 31 | // TODO - 'default' might become configurable or something else in the future. |
32 | 32 | // See https://www.drupal.org/node/2510274 |
33 | 33 | $form_display = \Drupal::entityTypeManager()->getStorage('entity_form_display')->load($entity_form_id); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | ])); |
48 | 48 | |
49 | 49 | $cardinality = FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED; |
50 | - if($instance->getFieldStorageDefinition()->get('cardinality') !== $cardinality) { |
|
50 | + if ($instance->getFieldStorageDefinition()->get('cardinality') !== $cardinality) { |
|
51 | 51 | $cardinality = $instance->getFieldStorageDefinition()->get('cardinality') - $count_existing_selection; |
52 | 52 | } |
53 | 53 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $ief_id = $reference_form['#ief_id']; |
120 | 120 | $form_values = NestedArray::getValue($form_state->getValues(), $reference_form['#parents']); |
121 | 121 | $attach_entities = EntityBrowserElement::processEntityIds($form_values['entity_browser']['entity_ids']); |
122 | - $entities =& $form_state->get(['inline_entity_form', $ief_id, 'entities']); |
|
122 | + $entities = & $form_state->get(['inline_entity_form', $ief_id, 'entities']); |
|
123 | 123 | |
124 | 124 | // Determine the correct weight of the new element. |
125 | 125 | $weight = 0; |
@@ -90,9 +90,9 @@ discard block |
||
90 | 90 | $entity_browser = $cached_values['entity_browser']; |
91 | 91 | |
92 | 92 | if (empty($entity_browser->id())) { |
93 | - $help_text = '<div class="clearfix eb-help-text"><h2>' . $this->t('Entity Browser creation instructions') . '</h2>'; |
|
94 | - $help_text .= '<p>' . $this->t('This is a multi-step form. In this first step you need to define the main characteristics of the Entity Browser (in other words, which plugins will be used for each functionality). In the following steps of this wizard, each individual plugin can be configured, when necessary.') . '</p>'; |
|
95 | - $help_text .= '<p>' . $this->t('You can find more detailed information about creating and configuring Entity Browsers at the <a href="@guide_href" target="_blank">official documentation</a>.', ['@guide_href' => 'https://drupal-media.gitbooks.io/drupal8-guide/content/modules/entity_browser/intro.html']) . '</p>'; |
|
93 | + $help_text = '<div class="clearfix eb-help-text"><h2>'.$this->t('Entity Browser creation instructions').'</h2>'; |
|
94 | + $help_text .= '<p>'.$this->t('This is a multi-step form. In this first step you need to define the main characteristics of the Entity Browser (in other words, which plugins will be used for each functionality). In the following steps of this wizard, each individual plugin can be configured, when necessary.').'</p>'; |
|
95 | + $help_text .= '<p>'.$this->t('You can find more detailed information about creating and configuring Entity Browsers at the <a href="@guide_href" target="_blank">official documentation</a>.', ['@guide_href' => 'https://drupal-media.gitbooks.io/drupal8-guide/content/modules/entity_browser/intro.html']).'</p>'; |
|
96 | 96 | $help_text .= '</div>'; |
97 | 97 | $form['help_text'] = [ |
98 | 98 | '#markup' => $help_text, |
@@ -100,10 +100,10 @@ discard block |
||
100 | 100 | } |
101 | 101 | |
102 | 102 | $displays = []; |
103 | - $display_description = $this->t('Choose here how the browser(s) should be presented to the end user. The available plugins are:') . '<ul>'; |
|
103 | + $display_description = $this->t('Choose here how the browser(s) should be presented to the end user. The available plugins are:').'<ul>'; |
|
104 | 104 | foreach ($this->displayManager->getDefinitions() as $plugin_id => $plugin_definition) { |
105 | 105 | $displays[$plugin_id] = $plugin_definition['label']; |
106 | - $display_description .= '<li><b>' . $plugin_definition['label'] . ':</b> ' . $plugin_definition['description'] . '</li>'; |
|
106 | + $display_description .= '<li><b>'.$plugin_definition['label'].':</b> '.$plugin_definition['description'].'</li>'; |
|
107 | 107 | } |
108 | 108 | $display_description .= '</ul>'; |
109 | 109 | $form['display'] = [ |
@@ -116,10 +116,10 @@ discard block |
||
116 | 116 | ]; |
117 | 117 | |
118 | 118 | $widget_selectors = []; |
119 | - $widget_description = $this->t('In the last step of the entity browser configuration you can decide how the widgets will be available to the editor. The available plugins are:') . '<ul>'; |
|
119 | + $widget_description = $this->t('In the last step of the entity browser configuration you can decide how the widgets will be available to the editor. The available plugins are:').'<ul>'; |
|
120 | 120 | foreach ($this->widgetSelectorManager->getDefinitions() as $plugin_id => $plugin_definition) { |
121 | 121 | $widget_selectors[$plugin_id] = $plugin_definition['label']; |
122 | - $widget_description .= '<li><b>' . $plugin_definition['label'] . ':</b> ' . $plugin_definition['description'] . '</li>'; |
|
122 | + $widget_description .= '<li><b>'.$plugin_definition['label'].':</b> '.$plugin_definition['description'].'</li>'; |
|
123 | 123 | } |
124 | 124 | $widget_description .= '</ul>'; |
125 | 125 | $form['widget_selector'] = [ |
@@ -132,10 +132,10 @@ discard block |
||
132 | 132 | ]; |
133 | 133 | |
134 | 134 | $selection_display = []; |
135 | - $selection_description = $this->t('You can optionally allow a "work-in-progress selection zone" to be available to the editor, while still navigating, browsing and selecting the entities. The available plugins are:') . '<ul>'; |
|
135 | + $selection_description = $this->t('You can optionally allow a "work-in-progress selection zone" to be available to the editor, while still navigating, browsing and selecting the entities. The available plugins are:').'<ul>'; |
|
136 | 136 | foreach ($this->selectionDisplayManager->getDefinitions() as $plugin_id => $plugin_definition) { |
137 | 137 | $selection_display[$plugin_id] = $plugin_definition['label']; |
138 | - $selection_description .= '<li><b>' . $plugin_definition['label'] . ':</b> ' . $plugin_definition['description'] . '</li>'; |
|
138 | + $selection_description .= '<li><b>'.$plugin_definition['label'].':</b> '.$plugin_definition['description'].'</li>'; |
|
139 | 139 | } |
140 | 140 | $selection_description .= '</ul>'; |
141 | 141 | $form['selection_display'] = [ |
@@ -53,10 +53,10 @@ discard block |
||
53 | 53 | $entity_browser = $form_state->getTemporaryValue('wizard')['entity_browser']; |
54 | 54 | |
55 | 55 | $widgets = []; |
56 | - $description = $this->t('The available plugins are:') . '<ul>'; |
|
56 | + $description = $this->t('The available plugins are:').'<ul>'; |
|
57 | 57 | foreach ($this->widgetManager->getDefinitions() as $plugin_id => $plugin_definition) { |
58 | 58 | $widgets[$plugin_id] = $plugin_definition['label']; |
59 | - $description .= '<li><b>' . $plugin_definition['label'] . ':</b> ' . $plugin_definition['description'] . '</li>'; |
|
59 | + $description .= '<li><b>'.$plugin_definition['label'].':</b> '.$plugin_definition['description'].'</li>'; |
|
60 | 60 | } |
61 | 61 | $description .= '</ul>'; |
62 | 62 | $default_widgets = []; |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | $form['widget'] = [ |
68 | 68 | '#type' => 'select', |
69 | 69 | '#title' => $this->t('Add widget plugin'), |
70 | - '#options' => ['_none_' => '- ' . $this->t('Select a widget to add it') . ' -'] + $widgets, |
|
70 | + '#options' => ['_none_' => '- '.$this->t('Select a widget to add it').' -'] + $widgets, |
|
71 | 71 | '#description' => $description, |
72 | 72 | '#ajax' => [ |
73 | 73 | 'callback' => [get_class($this), 'tableUpdatedAjaxCallback'], |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | $row['remove'] = [ |
122 | 122 | '#type' => 'submit', |
123 | 123 | '#value' => $this->t('Delete'), |
124 | - '#name' => 'remove' . $uuid, |
|
124 | + '#name' => 'remove'.$uuid, |
|
125 | 125 | '#ajax' => [ |
126 | 126 | 'callback' => [get_class($this), 'tableUpdatedAjaxCallback'], |
127 | 127 | 'wrapper' => 'widgets', |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | 'entity_browser' => [ |
158 | 158 | 'iframe' => [ |
159 | 159 | $this->getUuid() => [ |
160 | - 'src' => Url::fromRoute('entity_browser.' . $this->configuration['entity_browser_id'], [], $data['query_parameters']) |
|
160 | + 'src' => Url::fromRoute('entity_browser.'.$this->configuration['entity_browser_id'], [], $data['query_parameters']) |
|
161 | 161 | ->toString(), |
162 | 162 | 'width' => $this->configuration['width'], |
163 | 163 | 'height' => $this->configuration['height'], |
@@ -185,15 +185,15 @@ discard block |
||
185 | 185 | public function propagateSelection(FilterResponseEvent $event) { |
186 | 186 | $render = [ |
187 | 187 | 'labels' => [ |
188 | - '#markup' => 'Labels: ' . implode(', ', array_map(function (EntityInterface $item) { |
|
188 | + '#markup' => 'Labels: '.implode(', ', array_map(function(EntityInterface $item) { |
|
189 | 189 | return $item->label(); |
190 | 190 | }, $this->entities)), |
191 | 191 | '#attached' => [ |
192 | - 'library' => ['entity_browser/'. $this->pluginDefinition['id'] . '_selection'], |
|
192 | + 'library' => ['entity_browser/'.$this->pluginDefinition['id'].'_selection'], |
|
193 | 193 | 'drupalSettings' => [ |
194 | 194 | 'entity_browser' => [ |
195 | 195 | $this->pluginDefinition['id'] => [ |
196 | - 'entities' => array_map(function (EntityInterface $item) { |
|
196 | + 'entities' => array_map(function(EntityInterface $item) { |
|
197 | 197 | return [$item->id(), $item->uuid(), $item->getEntityTypeId()]; |
198 | 198 | }, $this->entities), |
199 | 199 | 'uuid' => $this->request->query->get('uuid'), |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | * {@inheritdoc} |
212 | 212 | */ |
213 | 213 | public function path() { |
214 | - return '/entity-browser/' . $this->pluginDefinition['id'] . '/' . $this->configuration['entity_browser_id']; |
|
214 | + return '/entity-browser/'.$this->pluginDefinition['id'].'/'.$this->configuration['entity_browser_id']; |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | /** |
@@ -109,7 +109,7 @@ |
||
109 | 109 | */ |
110 | 110 | public function calculateDependencies() { |
111 | 111 | $dependencies = parent::calculateDependencies(); |
112 | - if ($view_mode = $this->entityTypeManager->getStorage('entity_view_mode')->load($this->configuration['entity_type'] . '.' . $this->configuration['view_mode'])) { |
|
112 | + if ($view_mode = $this->entityTypeManager->getStorage('entity_view_mode')->load($this->configuration['entity_type'].'.'.$this->configuration['view_mode'])) { |
|
113 | 113 | $dependencies[$view_mode->getConfigDependencyKey()][] = $view_mode->getConfigDependencyName(); |
114 | 114 | } |
115 | 115 | return $dependencies; |