コード例 #1
0
ファイル: FeedsPermissions.php プロジェクト: Tawreh/mtg
 /**
  * Returns an array of feeds type permissions.
  *
  * @return array
  */
 public function feedTypePermissions()
 {
     $perms = [];
     // Generate feeds permissions for all feeds types.
     foreach (FeedType::loadMultiple() as $type) {
         $perms += $this->buildPermissions($type);
     }
     return $perms;
 }
コード例 #2
0
ファイル: EntityProcessorBase.php プロジェクト: Tawreh/mtg
 /**
  * Deletes the feeds_item field.
  */
 protected function removeFeedItemField()
 {
     $storage_in_use = FALSE;
     $instance_in_use = FALSE;
     foreach (FeedType::loadMultiple() as $feed_type) {
         if ($feed_type->id() === $this->feedType->id()) {
             continue;
         }
         $processor = $feed_type->getProcessor();
         if (!$processor instanceof EntityProcessorInterface) {
             continue;
         }
         if ($processor->entityType() === $this->entityType()) {
             $storage_in_use = TRUE;
             if ($processor->bundle() === $this->bundle()) {
                 $instance_in_use = TRUE;
                 break;
             }
         }
     }
     if ($instance_in_use) {
         return;
     }
     // Delete the field instance.
     if ($config = FieldConfig::loadByName($this->entityType(), $this->bundle(), 'feeds_item')) {
         $config->delete();
     }
     if ($storage_in_use) {
         return;
     }
     // Delte the field storage.
     if ($storage = FieldStorageConfig::loadByName($this->entityType(), 'feeds_item')) {
         $storage->delete();
     }
 }