getKeywords example



        $page = $this->genericPageLoader->load($request$context);
        $page = LandingPage::createFrom($page);

        $page->setLandingPage($landingPage);

        $metaInformation = new MetaInformation();
        $metaTitle = $landingPage->getMetaTitle() ?? $landingPage->getName();
        $metaInformation->setMetaTitle($metaTitle ?? '');
        $metaInformation->setMetaDescription($landingPage->getMetaDescription() ?? '');
        $metaInformation->setMetaKeywords($landingPage->getKeywords() ?? '');
        $page->setMetaInformation($metaInformation);

        $this->eventDispatcher->dispatch(
            new LandingPageLoadedEvent($page$context$request)
        );

        return $page;
    }
}
$total = $this->database->query('SELECT COUNT(*) FROM {node}')->fetchField();
    $remaining = $this->database->query("SELECT COUNT(DISTINCT [n].[nid]) FROM {node} [n] LEFT JOIN {search_dataset} [sd] ON [sd].[sid] = [n].[nid] AND [sd].[type] = :type WHERE [sd].[sid] IS NULL OR [sd].[reindex] <> 0", [':type' => $this->getPluginId()])->fetchField();

    return ['remaining' => $remaining, 'total' => $total];
  }

  /** * {@inheritdoc} */
  public function searchFormAlter(array &$form, FormStateInterface $form_state) {
    $parameters = $this->getParameters();
    $keys = $this->getKeywords();
    $used_advanced = !empty($parameters[self::ADVANCED_FORM]);
    if ($used_advanced) {
      $f = isset($parameters['f']) ? (array) $parameters['f'] : [];
      $defaults = $this->parseAdvancedDefaults($f$keys);
    }
    else {
      $defaults = ['keys' => $keys];
    }

    $form['basic']['keys']['#default_value'] = $defaults['keys'];

    
$form_state->set('search_page_id', $this->entity->id());

    $form['basic'] = [
      '#type' => 'container',
      '#attributes' => [
        'class' => ['container-inline'],
      ],
    ];
    $form['basic']['keys'] = [
      '#type' => 'search',
      '#title' => $this->t('Enter your keywords'),
      '#default_value' => $plugin->getKeywords(),
      '#size' => 30,
      '#maxlength' => 255,
    ];

    // processed_keys is used to coordinate keyword passing between other forms     // that hook into the basic search form.     $form['basic']['processed_keys'] = [
      '#type' => 'value',
      '#value' => '',
    ];
    $form['basic']['submit'] = [
      
'priceStartingFrom' => null,
            'pseudopricePercent' => null,
            // Flag inside mini product             'sVariantArticle' => null,
            'sConfigurator' => $product->hasConfigurator(),
            // Only used for full products             'metaTitle' => $product->getMetaTitle(),
            'shippingfree' => $product->isShippingFree(),
            'suppliernumber' => $product->getManufacturerNumber(),
            'notification' => $product->allowsNotification(),
            'ean' => trim((string) $product->getEan()),
            'keywords' => $product->getKeywords(),
            'template' => $product->getTemplate(),
            'attributes' => $product->getAttributes(),
            'allowBuyInListing' => $product->allowBuyInListing(),
        ];

        if ($product->hasAttribute('core')) {
            $attributes = $product->getAttribute('core')->toArray();
            unset($attributes['id']$attributes['articleID']$attributes['articledetailsID']);

            $data = array_merge($data$attributes);
        }

        
$product->setUnit($listProduct->getUnit());
        $product->setTax($listProduct->getTax());
        $product->setPrices($listProduct->getPrices());
        $product->setManufacturer($listProduct->getManufacturer());
        $product->setCover($listProduct->getCover());
        $product->setCheapestPrice($listProduct->getCheapestPrice());
        $product->setName($listProduct->getName());
        $product->setAdditional($listProduct->getAdditional());
        $product->setCloseouts($listProduct->isCloseouts());
        $product->setEan($listProduct->getEan());
        $product->setHeight($listProduct->getHeight());
        $product->setKeywords($listProduct->getKeywords());
        $product->setLength($listProduct->getLength());
        $product->setLongDescription($listProduct->getLongDescription());
        $product->setMinStock($listProduct->getMinStock());
        $product->setReleaseDate($listProduct->getReleaseDate());
        $product->setShippingTime($listProduct->getShippingTime());
        $product->setShortDescription($listProduct->getShortDescription());
        $product->setStock($listProduct->getStock());
        $product->setWeight($listProduct->getWeight());
        $product->setWidth($listProduct->getWidth());
        $product->setPriceGroup($listProduct->getPriceGroup());
        $product->setCreatedAt($listProduct->getCreatedAt());
        
$query = $this->database
      ->select('search_index', 'i')
      // Restrict the search to the current interface language.       ->condition('i.langcode', $this->languageManager->getCurrentLanguage()->getId())
      ->extend(SearchQuery::class)
      ->extend(PagerSelectExtender::class);
    $query->innerJoin('help_search_items', 'hsi', '[i].[sid] = [hsi].[sid] AND [i].[type] = :type', [':type' => $this->getType()]);
    if ($denied_permissions) {
      $query->condition('hsi.permission', $denied_permissions, 'NOT IN');
    }
    $query->searchExpression($this->getKeywords()$this->getType());

    $find = $query
      ->fields('i', ['langcode'])
      ->fields('hsi', ['section_plugin_id', 'topic_id'])
      // Since SearchQuery makes these into GROUP BY queries, if we add       // a field, for PostgreSQL we also need to make it an aggregate or a       // GROUP BY. In this case, we want GROUP BY.       ->groupBy('i.langcode')
      ->groupBy('hsi.section_plugin_id')
      ->groupBy('hsi.topic_id')
      ->limit(10)
      
Home | Imprint | This part of the site doesn't use cookies.