-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#52 Change to make the owner of the message the recipient and to add
the Entity Reference Prepopulate module.
- Loading branch information
1 parent
f4ac8bb
commit d565efd
Showing
12 changed files
with
1,619 additions
and
6 deletions.
There are no files selected for viewing
339 changes: 339 additions & 0 deletions
339
sites/all/modules/contrib/entityreference_prepopulate/LICENSE.txt
Large diffs are not rendered by default.
Oops, something went wrong.
42 changes: 42 additions & 0 deletions
42
sites/all/modules/contrib/entityreference_prepopulate/README.txt
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,42 @@ | ||
Description | ||
=========== | ||
Allows the contents of an "Entity Reference" field to be pre-populated by | ||
taking a parameter from the URL path. | ||
|
||
Install | ||
======= | ||
1. Download and enable the module. | ||
2. Visit admin/structure/types/manage/[ENTITY-TYPE]/fields/[FIELD-NAME] | ||
3. Enable "Entity reference prepopulate" under the instance settings. | ||
|
||
|
||
Configuration | ||
============= | ||
Enable Entity reference prepopulate: | ||
Check this to enable Entity reference prepopulate on this field. | ||
Action | ||
Using the select box choose the action to take if the entity reference | ||
field is pre-populated. | ||
Fallback behaviour | ||
Select what to do if the URL path does NOT contain a parameter to | ||
pre-populate the field. | ||
Skip access permission | ||
This is a fallback override, the fallback behaviour will not be followed | ||
for users with the specified permission. | ||
|
||
Usage | ||
===== | ||
In order to pre-populate an entity reference field you have to supply the | ||
parameter in the URL. | ||
|
||
The structure is | ||
node/add/article?[field_ref]=[id] | ||
|
||
Where [field_ref] is the name of the entity reference field and [id] is | ||
the id of the entity being referenced. | ||
|
||
Examples: | ||
node/add/article?field_foo=1 | ||
node/add/page?field_bar=1,2,3 | ||
|
||
|
46 changes: 46 additions & 0 deletions
46
sites/all/modules/contrib/entityreference_prepopulate/entityreference_prepopulate.api.php
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,46 @@ | ||
<?php | ||
|
||
|
||
/** | ||
* @file | ||
* Hooks provided by the Entity reference prepopulate module. | ||
*/ | ||
|
||
/** | ||
* @addtogroup hooks | ||
* @{ | ||
*/ | ||
|
||
/** | ||
* Register a new prepopulate provider. | ||
* | ||
* @return | ||
* Array of providers keyed by the provider name, and the following as value: | ||
* - title: The title of the provider. | ||
* - description: The description of the provider. | ||
* - callback: The function that will be called to get the values. | ||
* - disabled: (optional), determines if the provider should be disabled. | ||
*/ | ||
function hook_entityreference_prepopulate_providers_info() { | ||
return array( | ||
'url' => array( | ||
'title' => t('URL'), | ||
'description' => t('Prepopulate from URL'), | ||
'callback' => 'entityreference_prepopulate_get_values_from_url', | ||
), | ||
); | ||
} | ||
|
||
/** | ||
* Alter providers list. | ||
* | ||
* @param $providers | ||
* Array keyed by the provider name, and and array of values. | ||
*/ | ||
function entityreference_prepopulate_providers_info_alter(&$providers) { | ||
$providers['url']['disabled'] = TRUE; | ||
} | ||
|
||
/** | ||
* @} End of "addtogroup hooks". | ||
*/ |
14 changes: 14 additions & 0 deletions
14
sites/all/modules/contrib/entityreference_prepopulate/entityreference_prepopulate.info
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,14 @@ | ||
name = Entity reference prepopulate | ||
description = Prepopulate entity reference values from URL. | ||
core = 7.x | ||
package = Fields | ||
dependencies[] = entityreference | ||
|
||
files[] = entityreference_prepopulate.test | ||
|
||
; Information added by Drupal.org packaging script on 2014-02-19 | ||
version = "7.x-1.5" | ||
core = "7.x" | ||
project = "entityreference_prepopulate" | ||
datestamp = "1392845305" | ||
|
Oops, something went wrong.