trait InstallingTrait in Search API 8
Provides a helper method for checking a saved config entity's source.
Hierarchy
- trait \Drupal\search_api\Entity\InstallingTrait
File
- src/
Entity/ InstallingTrait.php, line 8
Namespace
Drupal\search_api\EntityView source
trait InstallingTrait {
/**
* Determines if this config entity is being installed from an extension.
*
* @return bool
* TRUE if the item is being installed from an extension; FALSE otherwise.
*/
protected function isInstallingFromExtension() {
// A configuration item is being installed from an extension if both of the
// following are true:
// - It is marked as new.
// - It has the _core property set.
// @see \Drupal\core\Config\ConfigInstaller::installConfiguration().
return $this
->isNew() && !empty($this->_core);
}
/**
* Determines whether the entity is new.
*
* Usually an entity is new if no ID exists for it yet. However, entities may
* be enforced to be new with existing IDs too.
*
* @return bool
* TRUE if the entity is new, or FALSE if the entity has already been saved.
*
* @see \Drupal\Core\Entity\EntityInterface::isNew()
*/
public abstract function isNew();
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
InstallingTrait:: |
protected | function | Determines if this config entity is being installed from an extension. | |
InstallingTrait:: |
abstract public | function | Determines whether the entity is new. |