diff --git a/entityform.module b/entityform.module index 22d8bdc..f32947c 100644 --- a/entityform.module +++ b/entityform.module @@ -269,6 +269,35 @@ function entityform_permission() { return $permissions; } +/** + * Implements hook_block_info(). + */ +function entityform_block_info() { + $blocks = array(); + foreach (entityform_get_types() as $entityform_type) { + $blocks[$entityform_type->type] = array( + 'info' => t('Entityform: ' . $entityform_type->label()), + // DRUPAL_CACHE_PER_ROLE will be assumed. + ); + } + return $blocks; +} + +/** + * Implements hook_block_view(). + */ +function entityform_block_view($delta = '') { + module_load_include('inc', 'entityform', 'entityform.admin'); + $block = array(); + foreach (entityform_get_types() as $entityform_type) { + if ($delta === $entityform_type->type) { + $block['subject'] = t($entityform_type->label()); + $block['content'] = entityform_form_wrapper(entityform_empty_load($entityform_type->type), 'submit', 'embedded'); + break; + } + } + return $block; +} /** * Determines whether the given user has access to a entityform.