Skip to content

Commit

Permalink
Added uninstaller and made config files optional.
Browse files Browse the repository at this point in the history
  • Loading branch information
mccrodp committed Jun 25, 2016
1 parent e109444 commit 48c3ae3
Show file tree
Hide file tree
Showing 22 changed files with 40 additions and 143 deletions.
29 changes: 7 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ CONTENTS OF THIS FILE
* Configuration
* How to use
* Security
* Development and Test
* Development road-map
* Maintainers


Expand Down Expand Up @@ -41,28 +41,16 @@ INSTALLATION

CONFIGURATION
-------------
Enabling Permissions:
* "View a new message instance for Private Message" &
"Create a new message instance for Private Message" for users needing to create
and view private messages.
* To hide private messages from this view, you must override view provided by
Message module: admin/structure/views/view/message/edit

When enabled, the module will provide a new message type "Private Message" and a
Message Private View.

Message Create Limits:
* Message creation limits can be managed per role on the module settings form.
A message create limit can be set per interval per role. Users with more than
one role get the maximum limit by calculating the lowest time per message over
each role. Users with the 'bypass private message access control' permission
bypass these limitations.
Show message form fields at: admin/structure/message/manage/private_message/form-display
Show message display fields at: admin/structure/message/manage/private_message/display
Show user form fields: /admin/config/people/accounts/form-display
This will be addressed automatically later.


HOW TO USE
----------
To Create messages:
* Visit /admin/content/message/create/private-message and Save the message to
* Visit /message/add/private_message and Create the message to
send, or
* Visit the "Messages" tab detailed below and find the "Create a new message"
local action.
Expand All @@ -85,17 +73,14 @@ E.G:
* CAPTCHA method: https://www.drupal.org/project/recaptcha


DEVELOPMENT AND TEST
DEVELOPMENT ROAD-MAP
--------------------
* Integrate with Message FOS (FOSMessage) bridge module.
* Flag module on user entity to block/unblock users from messaging them
* Flag module on message entity to show/hide (delete) messages from users own
display
* Allow Operations links to display correctly on views, i.e. - show 'View' for
users with view permissions. Not showing currently due to custom permissions.
* Integrate with rolereference module or similar to provide sending to users
within a certain role.
* Tests should be created in a "tests" folder.


MAINTAINERS
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

File renamed without changes.
33 changes: 33 additions & 0 deletions message_private.install
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();
}
}
}
1 change: 0 additions & 1 deletion src/Form/MessagePrivateSettingsForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
namespace Drupal\message_private\Form;

use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Entity\ContentEntityTypeInterface;
use Drupal\Core\Entity\EntityManagerInterface;
use Drupal\Core\Form\ConfigFormBase;
use Drupal\Core\Form\FormStateInterface;
Expand Down

0 comments on commit 48c3ae3

Please sign in to comment.