本文整理汇总了PHP中Drupal\Core\Config\Entity\ConfigEntityBase::postDelete方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfigEntityBase::postDelete方法的具体用法?PHP ConfigEntityBase::postDelete怎么用?PHP ConfigEntityBase::postDelete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Drupal\Core\Config\Entity\ConfigEntityBase
的用法示例。
在下文中一共展示了ConfigEntityBase::postDelete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postDelete
/**
* {@inheritdoc}
*/
public static function postDelete(EntityStorageInterface $storage, array $entities)
{
parent::postDelete($storage, $entities);
foreach ($entities as $entity) {
entity_invoke_bundle_hook('delete', $entity->getEntityType()->getBundleOf(), $entity->id());
}
}
示例2: postDelete
/**
* {@inheritdoc}
*/
public static function postDelete(EntityStorageInterface $storage, array $entities)
{
parent::postDelete($storage, $entities);
foreach ($entities as $entity) {
$entity->deleteDisplays();
\Drupal::entityManager()->onBundleDelete($entity->id(), $entity->getEntityType()->getBundleOf());
}
}
示例3: postDelete
/**
* {@inheritdoc}
*/
public static function postDelete(EntityStorageInterface $storage, array $entities)
{
parent::postDelete($storage, $entities);
foreach ($entities as $style) {
// Flush cached media for the deleted style.
$style->flush();
// Check whether field settings need to be updated.
// In case no replacement style was specified, all image fields that are
// using the deleted style are left in a broken state.
if (!$style->isSyncing() && ($new_id = $style->getReplacementID())) {
// The deleted ID is still set as originalID.
$style->setName($new_id);
static::replaceImageStyle($style);
}
}
}
示例4: postDelete
/**
* {@inheritdoc}
*/
public static function postDelete(EntityStorageInterface $storage, array $entities)
{
parent::postDelete($storage, $entities);
$tempstore = \Drupal::service('user.tempstore')->get('views');
foreach ($entities as $entity) {
$tempstore->delete($entity->id());
}
}
示例5: postDelete
/**
* {@inheritdoc}
*/
public static function postDelete(EntityStorageInterface $storage, array $entities)
{
parent::postDelete($storage, $entities);
/** @var \Drupal\image\ImageStyleInterface[] $entities */
foreach ($entities as $style) {
// Flush cached media for the deleted style.
$style->flush();
// Clear the replacement ID, if one has been previously stored.
/** @var \Drupal\image\ImageStyleStorageInterface $storage */
$storage->clearReplacementId($style->id());
}
}
示例6: postDelete
/**
* {@inheritdoc}
*/
public static function postDelete(EntityStorageInterface $storage, array $entities)
{
parent::postDelete($storage, $entities);
// Invalidate the static caches.
\Drupal::service('pathauto.generator')->resetCaches();
}
示例7: postDelete
/**
* {@inheritdoc}
*/
public static function postDelete(EntityStorageInterface $storage, array $entities)
{
/** @var \Drupal\commerce_tax\Entity\TaxTypeInterface[] $entities */
parent::postDelete($storage, $entities);
// Delete the tax rates of each tax type.
$rates = [];
foreach ($entities as $entity) {
foreach ($entity->getRates() as $rate) {
$rates[$rate->id()] = $rate;
}
}
/** @var \Drupal\Core\Entity\EntityStorageInterface $rate_storage */
$rate_storage = \Drupal::service('entity_type.manager')->getStorage('commerce_tax_rate');
$rate_storage->delete($rates);
}
示例8: postDelete
/**
* {@inheritdoc}
*/
public static function postDelete(EntityStorageInterface $storage, array $entities)
{
parent::postDelete($storage, $entities);
// Remove file usage for any button icons.
foreach ($entities as $entity) {
/** @var \Drupal\embed\EmbedButtonInterface $entity */
if ($icon_file = $entity->getIconFile()) {
\Drupal::service('file.usage')->delete($icon_file, 'embed', $entity->getEntityTypeId(), $entity->id());
}
}
}
示例9: postDelete
/**
* {@inheritdoc}
*/
public static function postDelete(EntityStorageInterface $storage, array $entities)
{
parent::postDelete($storage, $entities);
static::routeBuilder()->setRebuildNeeded();
}
示例10: postDelete
/**
* {@inheritdoc}
*/
public static function postDelete(EntityStorageInterface $storage, array $entities)
{
parent::postDelete($storage, $entities);
if (\Drupal::moduleHandler()->moduleExists('views')) {
Views::viewsData()->clear();
// Remove this line when https://www.drupal.org/node/2370365 gets fixed.
Cache::invalidateTags(array('extension:views'));
\Drupal::cache('discovery')->delete('views:wizard');
}
/** @var \Drupal\user\SharedTempStore $temp_store */
$temp_store = \Drupal::service('user.shared_tempstore')->get('search_api_index');
foreach ($entities as $entity) {
try {
$temp_store->delete($entity->id());
} catch (TempStoreException $e) {
// Can't really be helped, I guess. But is also very unlikely to happen.
// Ignore it.
}
}
}
示例11: postDelete
/**
* {@inheritdoc}
*/
public static function postDelete(EntityStorageInterface $storage, array $entities)
{
parent::postDelete($storage, $entities);
if ($event_type = reset($entities)) {
EventType::courierContextCC($event_type->entity_type, 'delete');
}
// Rebuild routes and local tasks.
\Drupal::service('router.builder')->setRebuildNeeded();
// Rebuild local actions https://github.com/dpi/rng/issues/18
\Drupal::service('plugin.manager.menu.local_action')->clearCachedDefinitions();
}
示例12: postDelete
public static function postDelete(EntityStorageInterface $storage, array $entities)
{
parent::postDelete($storage, $entities);
\Drupal::service('router.builder')->setRebuildNeeded();
}
示例13: postDelete
/**
* {@inheritdoc}
*/
public static function postDelete(EntityStorageInterface $storage, array $entities)
{
parent::postDelete($storage, $entities);
/** @var \Drupal\simplenews\Subscription\SubscriptionManagerInterface $subscription_manager */
$subscription_manager = \Drupal::service('simplenews.subscription_manager');
foreach ($entities as $newsletter) {
$subscription_manager->deleteSubscriptions(array('subscriptions_target_id' => $newsletter->id()));
drupal_set_message(t('All subscriptions to newsletter %newsletter have been deleted.', array('%newsletter' => $newsletter->label())));
}
if (\Drupal::moduleHandler()->moduleExists('block')) {
// Make sure there are no active blocks for these newsletters.
$ids = \Drupal::entityQuery('block')->condition('plugin', 'simplenews_subscription_block')->condition('settings.newsletters.*', array_keys($entities), 'IN')->execute();
if ($ids) {
$blocks = Block::loadMultiple($ids);
foreach ($blocks as $block) {
$settings = $block->get('settings');
foreach ($entities as $newsletter) {
if (in_array($newsletter->id(), $settings['newsletters'])) {
unset($settings['newsletters'][array_search($newsletter->id(), $settings['newsletters'])]);
}
}
// If there are no enabled newsletters left, delete the block.
if (empty($settings['newsletters'])) {
$block->delete();
} else {
// otherwise, update the settings and save.
$block->set('settings', $settings);
$block->save();
}
}
}
}
}
示例14: postDelete
/**
* {@inheritdoc}
*/
public static function postDelete(EntityStorageInterface $storage, array $entities)
{
parent::postDelete($storage, $entities);
$search_page_repository = \Drupal::service('search.search_page_repository');
if (!$search_page_repository->isSearchActive()) {
$search_page_repository->clearDefaultSearchPage();
}
}
示例15: postDelete
/**
* {@inheritdoc}
*/
public static function postDelete(EntityStorageInterface $storage, array $entities)
{
/** @var \Drupal\commerce_tax\Entity\TaxRateInterface $entity */
parent::postDelete($storage, $entities);
// Delete the tax rates amounts of each tax rate.
$amounts = [];
foreach ($entities as $entity) {
foreach ($entity->getAmounts() as $amount) {
$amounts[$amount->id()] = $amount;
}
}
/** @var \Drupal\Core\Entity\EntityStorageInterface $rate_storage */
$amount_storage = \Drupal::service('entity_type.manager')->getStorage('commerce_tax_rate_amount');
$amount_storage->delete($amounts);
}