Commit 47ff0c92 authored by catch's avatar catch
Browse files

Issue #2888872 by dagmar, brentg, yogeshmpawar, ravi.shankar, anacolautti,...

Issue #2888872 by dagmar, brentg, yogeshmpawar, ravi.shankar, anacolautti, larowlan, alexpott: Hide type filter form in dblog view when there are no logs
parent 346d6098
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@

namespace Drupal\dblog\Plugin\views\filter;

use Drupal\Core\Form\FormStateInterface;
use Drupal\views\Plugin\views\filter\InOperator;

/**
@@ -21,4 +22,12 @@ public function getValueOptions() {
    return $this->valueOptions;
  }

  /**
   * {@inheritDoc}
   */
  protected function valueForm(&$form, FormStateInterface $form_state) {
    parent::valueForm($form, $form_state);
    $form['value']['#access'] = !empty($form['value']['#options']);
  }

}
+2 −0
Original line number Diff line number Diff line
@@ -724,12 +724,14 @@ public function testFilter() {
    $this->drupalGet('admin/reports/dblog', ['query' => ['order' => 'Type']]);
    $this->assertSession()->statusCodeEquals(200);
    $this->assertSession()->pageTextContains('Operations');
    $this->assertSession()->fieldExists('edit-type');

    // Clear all logs and make sure the confirmation message is found.
    $this->clearLogsEntries();
    // Confirm that the logs should be cleared.
    $this->submitForm([], 'Confirm');
    $this->assertSession()->pageTextContains('Database log cleared.');
    $this->assertSession()->fieldNotExists('edit-type');
  }

  /**