CustomWidget.php in Facets 8
File
tests/facets_custom_widget/src/Plugin/facets/widget/CustomWidget.php
View source
<?php
namespace Drupal\facets_custom_widget\Plugin\facets\widget;
use Drupal\facets\FacetInterface;
use Drupal\facets\Widget\WidgetPluginBase;
class CustomWidget extends WidgetPluginBase {
public function isPropertyRequired($name, $type) {
if ($type == 'processors' && $name == 'hide_non_narrowing_result_processor') {
return TRUE;
}
if ($type == 'settings' && $name == 'show_only_one_result') {
return TRUE;
}
return FALSE;
}
public function supportsFacet(FacetInterface $facet) {
return \Drupal::state()
->get('facets_test_supports_facet', TRUE);
}
}
Classes
Name |
Description |
CustomWidget |
A simple widget class that returns a simple array of the facet results. |