/** * Builds the tracker configuration form. * * @param \Drupal\search_api\IndexInterface $index * The index being created or edited. */ public function buildTrackerConfigForm(array &$form, FormStateInterface $form_state, IndexInterface $index) { if ($index->hasValidTracker()) { $tracker = $index->getTracker(); // @todo Create, use and save SubFormState already here, not only in // validate(). Also, use proper subset of $form for first parameter? if ($config_form = $tracker->buildConfigurationForm(array(), $form_state)) { $form['tracker_config']['#type'] = 'details'; $form['tracker_config']['#title'] = $this->t('Configure %plugin', array('%plugin' => $tracker->label())); $form['tracker_config']['#description'] = SafeMarkup::checkPlain($tracker->getDescription()); $form['tracker_config']['#open'] = $index->isNew(); $form['tracker_config'] += $config_form; } } elseif (!$index->isNew()) { drupal_set_message($this->t('The tracker plugin is missing or invalid.'), 'error'); } }
/** * {@inheritdoc} */ public function isNew() { return $this->entity->isNew(); }