forked from mccrodp/message_private
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added uninstaller and made config files optional.
- Loading branch information
mccrodp
committed
Jun 25, 2016
1 parent
e109444
commit 48c3ae3
Showing
22 changed files
with
40 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 0 additions & 37 deletions
37
config/install/core.entity_form_display.message.private_message.default.yml
This file was deleted.
Oops, something went wrong.
39 changes: 0 additions & 39 deletions
39
config/install/core.entity_view_display.message.private_message.default.yml
This file was deleted.
Oops, something went wrong.
22 changes: 0 additions & 22 deletions
22
config/install/core.entity_view_display.message.private_message.mail_body.yml
This file was deleted.
Oops, something went wrong.
22 changes: 0 additions & 22 deletions
22
config/install/core.entity_view_display.message.private_message.mail_subject.yml
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
/** | ||
* @file | ||
* Message Private un-installer. | ||
*/ | ||
|
||
/** | ||
* Implements hook_uninstall. | ||
* | ||
* Remove the field_message_private_usr_notify field. | ||
*/ | ||
function message_private_uninstall() { | ||
$properties = array( | ||
'entity_type' => 'user', | ||
'bundle' => 'user', | ||
'include_deleted' => TRUE, | ||
); | ||
|
||
// Get the fields based on the above properties. | ||
$fields = \Drupal::entityManager()->getStorage('field_config')->loadByProperties($properties); | ||
|
||
// Cycle through user fields looking for our user notify field. | ||
foreach ($fields as $field) { | ||
/* @var \Drupal\Core\Field\FieldConfigBase $field */ | ||
// If we have the user notify field, purge the data and remove. | ||
if(!empty($field->getName() == 'field_message_private_usr_notify')) { | ||
$entity_type = $field->getTargetEntityTypeId(); | ||
Drupal::entityManager()->getStorage($entity_type)->purgeFieldData($field, 100); | ||
field_purge_field($field); | ||
$field->delete(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters