@@ -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, |
@@ -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 | } |
@@ -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 | } |
@@ -64,7 +64,7 @@ |
||
| 64 | 64 | * {@inheritdoc} |
| 65 | 65 | */ |
| 66 | 66 | public function getFormId() { |
| 67 | - return 'entity_browser_' . $this->entityBrowser->id() . '_form'; |
|
| 67 | + return 'entity_browser_'.$this->entityBrowser->id().'_form'; |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -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 | /** |
@@ -63,8 +63,8 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | $default_value = implode(' ', array_map( |
| 66 | - function (EntityInterface $item) { |
|
| 67 | - return $item->getEntityTypeId() . ':' . $item->id(); |
|
| 66 | + function(EntityInterface $item) { |
|
| 67 | + return $item->getEntityTypeId().':'.$item->id(); |
|
| 68 | 68 | }, |
| 69 | 69 | $element['#default_value'] |
| 70 | 70 | )); |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | ['validators' => $validators, 'selected_entities' => $element['#default_value']] |
| 86 | 86 | ); |
| 87 | 87 | |
| 88 | - $hidden_id = Html::getUniqueId($element['#id'] . '-target'); |
|
| 88 | + $hidden_id = Html::getUniqueId($element['#id'].'-target'); |
|
| 89 | 89 | $element['entity_ids'] = [ |
| 90 | 90 | '#type' => 'hidden', |
| 91 | 91 | '#id' => $hidden_id, |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | $element['#attached']['drupalSettings']['entity_browser'] = [ |
| 98 | 98 | $entity_browser->getDisplay()->getUuid() => [ |
| 99 | 99 | 'cardinality' => $element['#cardinality'], |
| 100 | - 'selector' => '#' . $hidden_id, |
|
| 100 | + 'selector' => '#'.$hidden_id, |
|
| 101 | 101 | ], |
| 102 | 102 | ]; |
| 103 | 103 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | return array_map( |
| 140 | - function ($item) { |
|
| 140 | + function($item) { |
|
| 141 | 141 | list($entity_type, $entity_id) = explode(':', $item); |
| 142 | 142 | return \Drupal::entityTypeManager()->getStorage($entity_type)->load($entity_id); |
| 143 | 143 | }, |
@@ -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 | } |
@@ -51,22 +51,22 @@ |
||
| 51 | 51 | $this->assertFieldByXPath("//input[@type='hidden' and @id='edit-fancy-entity-browser-target']", '', "Entity browser's hidden element found."); |
| 52 | 52 | |
| 53 | 53 | $edit = [ |
| 54 | - 'fancy_entity_browser[entity_ids]' => $this->nodes[0]->getEntityTypeId() . ':' . $this->nodes[0]->id() . ' ' . $this->nodes[1]->getEntityTypeId() . ':' . $this->nodes[1]->id(), |
|
| 54 | + 'fancy_entity_browser[entity_ids]' => $this->nodes[0]->getEntityTypeId().':'.$this->nodes[0]->id().' '.$this->nodes[1]->getEntityTypeId().':'.$this->nodes[1]->id(), |
|
| 55 | 55 | ]; |
| 56 | 56 | $this->drupalPostForm(NULL, $edit, 'Submit'); |
| 57 | - $expected = 'Selected entities: ' . $this->nodes[0]->label() . ', ' . $this->nodes[1]->label(); |
|
| 57 | + $expected = 'Selected entities: '.$this->nodes[0]->label().', '.$this->nodes[1]->label(); |
|
| 58 | 58 | $this->assertText($expected, 'Selected entities detected.'); |
| 59 | 59 | |
| 60 | - $default_entity = $this->nodes[0]->getEntityTypeId() . ':' . $this->nodes[0]->id(); |
|
| 60 | + $default_entity = $this->nodes[0]->getEntityTypeId().':'.$this->nodes[0]->id(); |
|
| 61 | 61 | $this->drupalGet('/test-element', ['query' => ['default_entity' => $default_entity]]); |
| 62 | 62 | $this->assertLink('Select entities', 0, 'Trigger link found.'); |
| 63 | 63 | $this->assertFieldByXPath("//input[@type='hidden' and @id='edit-fancy-entity-browser-target']", $default_entity, "Entity browser's hidden element found."); |
| 64 | 64 | |
| 65 | 65 | $edit = [ |
| 66 | - 'fancy_entity_browser[entity_ids]' => $this->nodes[1]->getEntityTypeId() . ':' . $this->nodes[1]->id() . ' ' . $this->nodes[0]->getEntityTypeId() . ':' . $this->nodes[0]->id(), |
|
| 66 | + 'fancy_entity_browser[entity_ids]' => $this->nodes[1]->getEntityTypeId().':'.$this->nodes[1]->id().' '.$this->nodes[0]->getEntityTypeId().':'.$this->nodes[0]->id(), |
|
| 67 | 67 | ]; |
| 68 | 68 | $this->drupalPostForm(NULL, $edit, 'Submit'); |
| 69 | - $expected = 'Selected entities: ' . $this->nodes[1]->label() . ', ' . $this->nodes[0]->label(); |
|
| 69 | + $expected = 'Selected entities: '.$this->nodes[1]->label().', '.$this->nodes[0]->label(); |
|
| 70 | 70 | $this->assertText($expected, 'Selected entities detected.'); |
| 71 | 71 | } |
| 72 | 72 | |