@@ -31,7 +31,7 @@ |
||
31 | 31 | * {@inheritdoc} |
32 | 32 | */ |
33 | 33 | public function getFormId() { |
34 | - return 'entity_browser_' . $this->entity_browser->id() . '_form'; |
|
34 | + return 'entity_browser_'.$this->entity_browser->id().'_form'; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -73,8 +73,7 @@ discard block |
||
73 | 73 | $form_state->set('entity_form_initialized', TRUE); |
74 | 74 | if ($this->getRequest()->query->has('uuid')) { |
75 | 75 | $form_state->set(['entity_browser', 'instance_uuid'], $this->getRequest()->query->get('uuid')); |
76 | - } |
|
77 | - else { |
|
76 | + } else { |
|
78 | 77 | $form_state->set(['entity_browser', 'instance_uuid'], $this->uuidGenerator->generate()); |
79 | 78 | } |
80 | 79 | $form_state->set(['entity_browser', 'selected_entities'], []); |
@@ -161,8 +160,7 @@ discard block |
||
161 | 160 | |
162 | 161 | if (!$this->isSelectionCompleted($form_state)) { |
163 | 162 | $form_state->setRebuild(); |
164 | - } |
|
165 | - else { |
|
163 | + } else { |
|
166 | 164 | $this->entity_browser->getDisplay()->selectionCompleted($this->getSelectedEntities($form_state)); |
167 | 165 | } |
168 | 166 | } |
@@ -116,8 +116,7 @@ |
||
116 | 116 | |
117 | 117 | if (!$this->isSelectionCompleted($form_state)) { |
118 | 118 | $form_state->setRebuild(); |
119 | - } |
|
120 | - else { |
|
119 | + } else { |
|
121 | 120 | $entity_browser->getDisplay()->selectionCompleted($this->getSelectedEntities($form_state)); |
122 | 121 | } |
123 | 122 | } |
@@ -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)) { |
@@ -124,8 +124,7 @@ discard block |
||
124 | 124 | return [ |
125 | 125 | '#markup' => t('Entity browser select form field not found on a view. <a href=":link">Go fix it</a>!', [':link' => $url]), |
126 | 126 | ]; |
127 | - } |
|
128 | - else { |
|
127 | + } else { |
|
129 | 128 | return [ |
130 | 129 | '#markup' => t('Entity browser select form field not found on a view. Go fix it!'), |
131 | 130 | ]; |
@@ -183,8 +182,7 @@ discard block |
||
183 | 182 | ]); |
184 | 183 | $form_state->setError($form['widget']['view']['entity_browser_select'], $message); |
185 | 184 | } |
186 | - } |
|
187 | - catch (PluginNotFoundException $e) { |
|
185 | + } catch (PluginNotFoundException $e) { |
|
188 | 186 | $message = t('The Entity Type @type does not exist.', [ |
189 | 187 | '@type' => $parts[0], |
190 | 188 | ]); |
@@ -216,13 +216,13 @@ |
||
216 | 216 | foreach ($displays as $display) { |
217 | 217 | list($view_id, $display_id) = $display; |
218 | 218 | $view = $this->entityManager->getStorage('view')->load($view_id); |
219 | - $options[$view_id . '.' . $display_id] = $this->t('@view : @display', array('@view' => $view->label(), '@display' => $view->get('display')[$display_id]['display_title'])); |
|
219 | + $options[$view_id.'.'.$display_id] = $this->t('@view : @display', array('@view' => $view->label(), '@display' => $view->get('display')[$display_id]['display_title'])); |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | $form['view'] = [ |
223 | 223 | '#type' => 'select', |
224 | 224 | '#title' => $this->t('View : View display'), |
225 | - '#default_value' => $this->configuration['view'] . '.' . $this->configuration['view_display'], |
|
225 | + '#default_value' => $this->configuration['view'].'.'.$this->configuration['view_display'], |
|
226 | 226 | '#options' => $options, |
227 | 227 | '#empty_option' => $this->t('- Select a view -'), |
228 | 228 | '#required' => TRUE, |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $form['widget'] = [ |
76 | 76 | '#type' => 'select', |
77 | 77 | '#title' => $this->t('Add widget plugin'), |
78 | - '#options' => ['_none_' => '- ' . $this->t('Select a widget to add it') . ' -'] + $widgets, |
|
78 | + '#options' => ['_none_' => '- '.$this->t('Select a widget to add it').' -'] + $widgets, |
|
79 | 79 | '#ajax' => [ |
80 | 80 | 'callback' => [get_class($this), 'addWidgetCallback'], |
81 | 81 | 'wrapper' => 'widgets', |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | $row['remove'] = [ |
126 | 126 | '#type' => 'submit', |
127 | 127 | '#value' => $this->t('Delete'), |
128 | - '#name' => 'remove' . $uuid, |
|
128 | + '#name' => 'remove'.$uuid, |
|
129 | 129 | '#ajax' => [ |
130 | 130 | 'callback' => [get_class($this), 'addWidgetCallback'], |
131 | 131 | 'wrapper' => 'widgets', |
@@ -42,7 +42,7 @@ |
||
42 | 42 | /** |
43 | 43 | * Implements hook_form_alter(). |
44 | 44 | */ |
45 | -function entity_browser_form_alter(&$form, FormStateInterface &$form_state) { |
|
45 | +function entity_browser_form_alter(&$form, FormStateInterface&$form_state) { |
|
46 | 46 | $entity_browser_dialog_edit = \Drupal::service('request_stack')->getCurrentRequest()->get('_route'); |
47 | 47 | if ($entity_browser_dialog_edit == 'entity_browser.edit_form') { |
48 | 48 | // Let's allow the save button only. |
@@ -122,8 +122,7 @@ |
||
122 | 122 | $image->save(); |
123 | 123 | $file->filesize = $image->getFileSize(); |
124 | 124 | drupal_set_message(t('The image was resized to fit within the maximum allowed dimensions of %dimensions pixels.', array('%dimensions' => $maximum_dimensions))); |
125 | - } |
|
126 | - else { |
|
125 | + } else { |
|
127 | 126 | $errors[] = t('The image exceeds the maximum allowed dimensions.'); |
128 | 127 | } |
129 | 128 | } |
@@ -34,9 +34,7 @@ |
||
34 | 34 | * The entity manager. |
35 | 35 | * @param $tempstore_id |
36 | 36 | * The shared temp store factory collection name. |
37 | - * @param null $machine_name |
|
38 | - * The SharedTempStore key for our current wizard values. |
|
39 | - * @param null $step |
|
37 | + * @param string|null $step |
|
40 | 38 | * The current active step of the wizard. |
41 | 39 | */ |
42 | 40 | public function __construct(SharedTempStoreFactory $tempstore, FormBuilderInterface $builder, ClassResolverInterface $class_resolver, EventDispatcherInterface $event_dispatcher, EntityManagerInterface $entity_manager, RouteMatchInterface $route_match, $tempstore_id, $entity_browser = NULL, $step = 'general') { |
@@ -67,7 +67,7 @@ |
||
67 | 67 | $file = File::load(1); |
68 | 68 | // Test entity browser token that has upload location configured to |
69 | 69 | // public://[current-user:account-name]/ |
70 | - $this->assertEqual($file->getFileUri(), 'public://' . $account->getUsername() . '/' . $file->getFilename(), 'Image has the correct uri.'); |
|
70 | + $this->assertEqual($file->getFileUri(), 'public://'.$account->getUsername().'/'.$file->getFilename(), 'Image has the correct uri.'); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | } |
@@ -116,8 +116,7 @@ |
||
116 | 116 | |
117 | 117 | if (!$this->isSelectionCompleted($form_state)) { |
118 | 118 | $form_state->setRebuild(); |
119 | - } |
|
120 | - else { |
|
119 | + } else { |
|
121 | 120 | $entity_browser->getDisplay()->selectionCompleted($this->getSelectedEntities($form_state)); |
122 | 121 | } |
123 | 122 | } |
@@ -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; |
@@ -30,14 +30,14 @@ |
||
30 | 30 | */ |
31 | 31 | public function getRowId(ResultRow $row) { |
32 | 32 | $entity = $row->_entity; |
33 | - return $entity->getEntityTypeId() . ':' . $entity->id(); |
|
33 | + return $entity->getEntityTypeId().':'.$entity->id(); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
37 | 37 | * {@inheritdoc} |
38 | 38 | */ |
39 | 39 | public function render(ResultRow $values) { |
40 | - return ViewsRenderPipelineMarkup::create('<!--form-item-' . $this->options['id'] . '--' . $this->getRowId($values) . '-->'); |
|
40 | + return ViewsRenderPipelineMarkup::create('<!--form-item-'.$this->options['id'].'--'.$this->getRowId($values).'-->'); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |