diff --git a/entity_property_extra_fields/README.txt b/entity_property_extra_fields/README.txt deleted file mode 100644 index d3f9a77..0000000 --- a/entity_property_extra_fields/README.txt +++ /dev/null @@ -1,31 +0,0 @@ -CONTENTS OF THIS FILE ---------------------- - * Introduction - * Usage - -INTRODUCTION ------------- -This module provides a simple way to expose entity properties in the field UI's -"Manage fields" and "Manage display". - -To more details, check API documentation of hook_field_extra_fields(). - -USAGE ------ -Instead of implementing the hook_field_extra_fields() and define its structure -for each entity and property, just add/modify hook_entity_property_info() or -hook_entity_property_info_alter() adding a new option, that the module provides -to the properties that you want to expose in form fields UI's: - -// Exposes in "Manage fields" UI form. -'extra_fields' => array('form') - -OR - -// Exposes in "Manage display" UI form. -'extra_fields' => array('display') - -OR - -// Exposes in both, "Manage fields" and "Manage display" UI forms. -'extra_fields' => array('form', 'display') diff --git a/entity_property_extra_fields/entity_property_extra_fields.info b/entity_property_extra_fields/entity_property_extra_fields.info deleted file mode 100644 index 1df1bd0..0000000 --- a/entity_property_extra_fields/entity_property_extra_fields.info +++ /dev/null @@ -1,3 +0,0 @@ -name = Entity Property Extra Fields -description = This module provides a simple way to expose the entity properties in the field UI's "Manage fields" and "Manage display". -core = 7.x diff --git a/entity_property_extra_fields/entity_property_extra_fields.module b/entity_property_extra_fields/entity_property_extra_fields.module deleted file mode 100644 index 7df4ff4..0000000 --- a/entity_property_extra_fields/entity_property_extra_fields.module +++ /dev/null @@ -1,79 +0,0 @@ -data; - } - - $extra = entity_property_extra_fields_generate_extra_fields_structure(); - - // Sets new cache value. - cache_set('entity_property_extra_fields', $extra); - - return $extra; -} - -/** - * Generates a structured array for hook_field_extra_fields(). - * - * @return array - * A hook_field_extra_fields() structured array. - */ -function entity_property_extra_fields_generate_extra_fields_structure() { - $entities = entity_get_info(); - - $extra_fields = array(); - - foreach ($entities as $entity_type => $entity_info) { - $weight = -50; - - // Gets all properties by entity. - $entity_properties = entity_get_all_property_info($entity_type); - foreach ($entity_properties as $field_name => $field_properties) { - - // Checks if extra fields key exist in entity properties. - $extra_fields_key_exist = !empty($field_properties[ENTITY_PROPERTY_EXTRA_FIELDS_KEY]) && is_array($field_properties[ENTITY_PROPERTY_EXTRA_FIELDS_KEY]); - if ($extra_fields_key_exist) { - - // Separates by context ('display', 'form'). - foreach ($field_properties[ENTITY_PROPERTY_EXTRA_FIELDS_KEY] as $context) { - - // Creates the structure to each bundle. - foreach (array_keys($entity_info['bundles']) as $bundle) { - $extra_fields[$entity_type][$bundle][$context][$field_name] = array( - 'label' => $field_properties['label'], - 'description' => isset($field_properties['description']) ? $field_properties['description'] : '', - 'weight' => $weight, - ); - } - } - } - - ++$weight; - } - } - - return $extra_fields; -} diff --git a/wf_environment/wf_environment.module b/wf_environment/wf_environment.module index 2aa0286..d6935d8 100644 --- a/wf_environment/wf_environment.module +++ b/wf_environment/wf_environment.module @@ -15,6 +15,7 @@ function wf_environment_entity_info() { 'label' => t('Workflow Environment'), 'entity class' => 'WfEnvironment', 'controller class' => 'EntityAPIController', + 'extra fields controller class' => 'EntityPropertyExtraFieldsController', 'base table' => 'wf_env', 'revision table' => 'wf_env_revision', 'fieldable' => TRUE, diff --git a/wf_job/wf_job.module b/wf_job/wf_job.module index 733ad5e..cc9c7d7 100644 --- a/wf_job/wf_job.module +++ b/wf_job/wf_job.module @@ -15,6 +15,7 @@ function wf_job_entity_info() { 'label' => t('Workflow Job'), 'entity class' => 'WfJob', 'controller class' => 'WfJobController', + 'extra fields controller class' => 'EntityPropertyExtraFieldsController', 'base table' => 'wf_job', 'revision table' => 'wf_job_revision', 'fieldable' => TRUE, diff --git a/wf_log/wf_log.module b/wf_log/wf_log.module index d8d0f09..4044c8c 100644 --- a/wf_log/wf_log.module +++ b/wf_log/wf_log.module @@ -19,6 +19,7 @@ function wf_log_entity_info() { 'label' => t('Workflow Log'), 'entity class' => 'WfLog', 'controller class' => 'WfLogController', + 'extra fields controller class' => 'EntityPropertyExtraFieldsController', 'base table' => 'wf_log', 'entity keys' => array( 'id' => 'lid', diff --git a/wf_site/wf_site.module b/wf_site/wf_site.module index 7c15e2a..a5ab6ab 100644 --- a/wf_site/wf_site.module +++ b/wf_site/wf_site.module @@ -15,6 +15,7 @@ function wf_site_entity_info() { 'label' => t('Workflow Site'), 'entity class' => 'WfSite', 'controller class' => 'WfSiteController', + 'extra fields controller class' => 'EntityPropertyExtraFieldsController', 'base table' => 'wf_site', 'revision table' => 'wf_site_revision', 'fieldable' => TRUE,