isSearchActive example

->method('condition')
      ->with('status', TRUE)
      ->willReturn($this->query);
    $this->query->expects($this->once())
      ->method('range')
      ->with(0, 1)
      ->willReturn($this->query);
    $this->query->expects($this->once())
      ->method('execute')
      ->willReturn(['test' => 'test']);

    $this->assertTrue($this->searchPageRepository->isSearchActive());
  }

  /** * Tests the getIndexableSearchPages() method. */
  public function testGetIndexableSearchPages() {
    $this->query->expects($this->once())
      ->method('condition')
      ->with('status', TRUE)
      ->willReturn($this->query);
    $this->query->expects($this->once())
      
parent::postSave($storage$update);
    $this->routeBuilder()->setRebuildNeeded();
  }

  /** * {@inheritdoc} */
  public static function postDelete(EntityStorageInterface $storage, array $entities) {
    parent::postDelete($storage$entities);

    $search_page_repository = \Drupal::service('search.search_page_repository');
    if (!$search_page_repository->isSearchActive()) {
      $search_page_repository->clearDefaultSearchPage();
    }
  }

  /** * {@inheritdoc} */
  public static function sort(ConfigEntityInterface $a, ConfigEntityInterface $b) {
    /** @var \Drupal\search\SearchPageInterface $a */
    /** @var \Drupal\search\SearchPageInterface $b */
    $a_status = (int) $a->status();
    
Home | Imprint | This part of the site doesn't use cookies.