summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNovitsh2015-09-25 14:05:48 (GMT)
committerNovitsh2015-09-25 14:05:48 (GMT)
commit66af146a79081e7908f3c75808cc3b3f43022570 (patch)
tree6ab89dc16a39aa7b34303e66bda0dda59d0d1e87
parent2edcf76c80cffac7f38d7251620b008e14ce09e7 (diff)
Issue by Novitsh: buildConfigurationForm initial commit.8.x-1.x-view-contexts
-rw-r--r--src/Context/ContextPluginManager.php33
-rw-r--r--src/Form/FacetForm.php3
2 files changed, 35 insertions, 1 deletions
diff --git a/src/Context/ContextPluginManager.php b/src/Context/ContextPluginManager.php
index afb6527..db3fc69 100644
--- a/src/Context/ContextPluginManager.php
+++ b/src/Context/ContextPluginManager.php
@@ -10,6 +10,8 @@ namespace Drupal\facetapi\Context;
use Drupal\Core\Cache\CacheBackendInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Plugin\DefaultPluginManager;
+use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Render\Element;
/**
* Manages context plugins.
@@ -36,4 +38,35 @@ class ContextPluginManager extends DefaultPluginManager {
$this->alterInfo('facetapi_context_info');
}
+ /**
+ * {@inheritdoc}
+ */
+ public function buildConfigurationForm(array $form, FormStateInterface $form_state) {
+ if ($this->hasBundles()) {
+ $bundles = $this->getEntityBundleOptions();
+ $form['default'] = array(
+ '#type' => 'radios',
+ '#title' => $this->t('What should be indexed?'),
+ '#options' => array(
+ 1 => $this->t('All except those selected'),
+ 0 => $this->t('None except those selected'),
+ ),
+ //'#default_value' => $this->configuration['default'],
+ );
+ $form['bundles'] = array(
+ '#type' => 'checkboxes',
+ '#title' => $this->t('Bundles'),
+ '#options' => $bundles,
+ //'#default_value' => $this->configuration['bundles'],
+ '#size' => min(4, count($bundles)),
+ '#multiple' => TRUE,
+ );
+ $form['test'] = array(
+ '#markup' => "test",
+ );
+ }
+
+ return $form;
+ }
+
}
diff --git a/src/Form/FacetForm.php b/src/Form/FacetForm.php
index 8565f9c..34ea3b3 100644
--- a/src/Form/FacetForm.php
+++ b/src/Form/FacetForm.php
@@ -16,6 +16,7 @@ use Drupal\Core\Url;
use Drupal\facetapi\FacetInterface;
use Drupal\facetapi\FacetApiException;
use Symfony\Component\DependencyInjection\ContainerInterface;
+use Drupal\facetapi\Context;
/**
* Provides a form for creating and editing search servers.
@@ -188,7 +189,7 @@ class FacetForm extends EntityForm {
*/
public function buildContextForm(array &$form, FormStateInterface $form_state, FacetInterface $facet) {
/**
- * @var FacetApiContext $context
+ * @var Context\ContextPluginManager $context
*/
foreach ($facet->getContextIds() as $context_id => $context) {
// @todo Create, use and save SubFormState already here, not only in