diff --git a/src/Entity/JobItem.php b/src/Entity/JobItem.php index d373f2f..3ea8047 100644 --- a/src/Entity/JobItem.php +++ b/src/Entity/JobItem.php @@ -574,7 +574,7 @@ class JobItem extends ContentEntityBase implements JobItemInterface { * * @return boolean */ - public function isAbortable() { + public function isAbortable() { if ($this->isActive() || $this->isNeedsReview()) { return $this->isActive(); } diff --git a/src/Form/JobItemForm.php b/src/Form/JobItemForm.php index 4edd76e..b48efa4 100644 --- a/src/Form/JobItemForm.php +++ b/src/Form/JobItemForm.php @@ -160,7 +160,7 @@ class JobItemForm extends TmgmtFormBase { $form['footer'] = tmgmt_color_review_legend(); return $form; } - + protected function actions(array $form, FormStateInterface $form_state) { $item = $this->entity; @@ -168,11 +168,11 @@ class JobItemForm extends TmgmtFormBase { $actions['abort_job_item'] = array( '#type' => 'submit', '#value' => t('Abort item'), - '#redirect' => 'admin/tmgmt/items/' .$item->id() .'/abort', + '#redirect' => 'admin/tmgmt/items/' .$item->id().'/abort', '#submit' => array('tmgmt_submit_redirect'), '#access' => $item->isAbortable(), - '#weight' => 10, - ); + '#weight' => 15, + ); $actions['accept'] = array( '#type' => 'submit', '#button_type' => 'primary', @@ -204,7 +204,6 @@ class JobItemForm extends TmgmtFormBase { '#validate' => ['::validateTags'], '#submit' => ['::submitForm'], ); - if ($item->getSourcePlugin() instanceof SourcePreviewInterface && $item->getSourcePlugin()->getPreviewUrl($item)) { $actions['preview'] = [ '#type' => 'link', @@ -215,7 +214,6 @@ class JobItemForm extends TmgmtFormBase { ], ]; } - return $actions; } @@ -270,7 +268,7 @@ class JobItemForm extends TmgmtFormBase { if (isset($value['data']['translation']['value'])) { $label = $value['data']['translation']['value']['#value']; } - else { + else { $label = $value['data']['translation']['#value']; } diff --git a/src/Tests/TMGMTUiTest.php b/src/Tests/TMGMTUiTest.php index 89163f9..5694e50 100644 --- a/src/Tests/TMGMTUiTest.php +++ b/src/Tests/TMGMTUiTest.php @@ -354,7 +354,7 @@ class TMGMTUiTest extends EntityTestBase { ))); $end_rows = $this->xpath('//tbody/tr'); $this->assertEqual(count($end_rows), 4); - $this->clickLink(t('Abort Item')); + $this->drupalPostForm('admin/tmgmt/items/1', NULL, t('Abort Item')); } /** @@ -468,7 +468,7 @@ class TMGMTUiTest extends EntityTestBase { $this->assertText('test_source:test_suggestion_suggestion:7'); } - + /** * Test the process of aborting and resubmitting the job. */