|
|
-Next, we must let Drupal know that our field exists. We do this by adding an entry to the ``$info`` array of in the ``hook_bundle_field_info()`` function described above. This let's Drupal know about our field. However, because we are not programmatically creating an instance of the field on a content type, but allowing the user to create them we do not need to implement the ``hook_bundle_instance_info()`` function. Instead, we must implement the ``hook_bundle_create_user_field()``. This function is called when the user attempts to add our new field to a bundle. One field that comes with Tripal is the ``chado_linker__prop`` field. Most Chado base tables have an associated property table (e.g. ``organismprop``, ``featureprop``, ``stockprop``, etc). By default, the ``tripal_chado`` module automatically adds this field to all bundles that have existing properties. It adds a new instance for every propert type. However, new properties can be added to bundle, and the site admin may want to add those properties via the user interface rather. Therefore, this field has the `$no_ui` set to TRUE and uses the ``hook_bundle_create_user_field()`` to create the new field instnace for the user.
|
|
|
+Next, we must let Drupal know that our field exists. We do this by adding an entry to the ``$info`` array of in the ``hook_bundle_field_info()`` function described above. This lets Drupal know about our field. However, because we are not programmatically creating an instance of the field on a content type, but allowing the user to create them we do not need to implement the ``hook_bundle_instance_info()`` function. Instead, we must implement the ``hook_bundle_create_user_field()``. This function is called when the user attempts to add our new field to a bundle. One field that comes with Tripal is the ``chado_linker__prop`` field. Most Chado base tables have an associated property table (e.g. ``organismprop``, ``featureprop``, ``stockprop``, etc). By default, the ``tripal_chado`` module automatically adds this field to all bundles that have existing properties. It adds a new instance for every property type. However, new properties can be added to bundle, and the site admin may want to add those properties via the user interface rather. Therefore, this field has the ``$no_ui`` set to TRUE and uses the ``hook_bundle_create_user_field()`` to create the new field instance for the user.
|