Skip to content

Commit 270cab1

Browse files
committed
Issue #1788892: Avoid entity_load() in MessageMetadataController.
1 parent b1e97c3 commit 270cab1

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

message.info.inc

+8-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,14 @@ class MessageMetadataController extends EntityDefaultMetadataController {
5151
'sanitize' => TRUE,
5252
);
5353

54+
// Bypass entity_load() as we cannot use it here.
55+
$message_types = db_select('message_type', 'mt')
56+
->fields('mt')
57+
->execute()
58+
->fetchAllAssoc('name');
59+
5460
// Add in the arguments specific to the bundles.
55-
foreach (message_type_load() as $name => $type) {
61+
foreach ($message_types as $name => $type) {
5662
$info['message']['bundles'][$name]['properties']['arguments'] = array(
5763
'label' => t('Message arguments'),
5864
'type' => 'struct',
@@ -61,7 +67,7 @@ class MessageMetadataController extends EntityDefaultMetadataController {
6167
'setter callback' => 'entity_property_verbatim_set',
6268
'property info' => array(),
6369
);
64-
$keys = array_filter($type->argument_keys);
70+
$keys = array_filter(unserialize($type->argument_keys));
6571
foreach ($keys as $key) {
6672
// Add the argument keys so they can later be referenced by
6773
// entity-metadata. For example if the message is "hello @foo", then

0 commit comments

Comments
 (0)