diff --git a/src/Entity/Index.php b/src/Entity/Index.php index e2a98d4..644c26d 100644 --- a/src/Entity/Index.php +++ b/src/Entity/Index.php @@ -153,12 +153,7 @@ class Index extends ConfigEntityBase implements IndexInterface { * * @var array */ - protected $tracker_settings = array( - 'default' => array( - 'plugin_id' => 'default', - 'settings' => array() - ), - ); + protected $tracker_settings = NULL; /** * The tracker plugin instance. @@ -361,7 +356,8 @@ class Index extends ConfigEntityBase implements IndexInterface { * {@inheritdoc} */ public function hasValidTracker() { - return (bool) \Drupal::service('plugin.manager.search_api.tracker')->getDefinition($this->getTrackerId(), FALSE); + return (bool) \Drupal::service('plugin.manager.search_api.tracker') + ->getDefinition($this->getTrackerId(), FALSE); } /** @@ -631,7 +627,7 @@ class Index extends ConfigEntityBase implements IndexInterface { } if (isset($this->getFields()[$new_field_id])) { $args['%field_id'] = $new_field_id; - throw new SearchApiException(new FormattableMarkup('%field_id already exists and can\'t be used as a new field id.', $args)); + throw new SearchApiException(new FormattableMarkup("%field_id already exists and can't be used as a new field id.", $args)); } $this->fieldInstances[$new_field_id] = $this->fieldInstances[$old_field_id]; @@ -1009,19 +1005,6 @@ class Index extends ConfigEntityBase implements IndexInterface { $this->disable(); } - $this->field_settings = array(); - foreach ($this->getFields() as $field_id => $field) { - $this->field_settings[$field_id] = $field->getSettings(); - } - - // Remove all "locked" and "hidden" flags from all fields of the index. If - // they are still valid, they should be re-added by the processors. - foreach ($this->field_settings as $field_id => $field_settings) { - unset($this->field_settings[$field_id]['indexed_locked']); - unset($this->field_settings[$field_id]['type_locked']); - unset($this->field_settings[$field_id]['hidden']); - } - // We first have to check for locked processors, otherwise their // preIndexSave() methods might not be called in the next step. $this->processor_settings = array(); diff --git a/src/Item/Field.php b/src/Item/Field.php index 2d14eb4..8580c59 100644 --- a/src/Item/Field.php +++ b/src/Item/Field.php @@ -167,7 +167,7 @@ class Field implements \IteratorAggregate, FieldInterface { * {@inheritdoc} */ public function setIndex(IndexInterface $index) { - if ($this->index instanceof IndexInterface && $this->index->id() != $index->id()) { + if ($this->index->id() != $index->id()) { throw new \InvalidArgumentException('Attempted to change the index of a field object.'); } $this->index = $index;