Applies cleanly at commit 1efe0a46393032793712fad4c16ae342ae9faa42 (branch 7.x-1.x-field).

This enables you to select 'payment form' as a field type, then it sends you to the field settings form. hook_field_settings_form() fires, but the actual implementation needs to be completed. I think this is probably the next step.

CommentFileSizeAuthor
#1 1339778-get-field-working.patch2.06 KBbryanhirsch

Comments

bryanhirsch’s picture

StatusFileSize
new2.06 KB

patch attached

bryanhirsch’s picture

The patch I submitted includes four tiny commits from my local git repo. It seemed silly to submit this as four separate patches. But, since I wrote the commit messages, here they are, in case this is helpful for patch review:

commit 556d75475e895c7a4cf8387a7b4ffad5dec208da
Author: Bryan Hirsch
Date: Sat Nov 12 14:52:41 2011 -0500

Fixed tiny bug, missing ) in .install file.

diff --git a/pay.install b/pay.install
index d1ef364..20dda94 100644
--- a/pay.install
+++ b/pay.install
@@ -480,5 +480,5 @@ function pay_update_7001() {
}
}

- return t('Created "%table" table.', array('%table' => $name);
+ return t('Created "%table" table.', array('%table' => $name));
}

commit cc20cf78d95a5a5a4f374815660dc517746faaa5
Author: Bryan Hirsch
Date: Sat Nov 12 15:07:19 2011 -0500

Fix functions names. Change pay_field_field_x to pay_field_x.

diff --git a/pay.field.inc b/pay.field.inc
index 4b25a2d..672989d 100644
--- a/pay.field.inc
+++ b/pay.field.inc
@@ -8,11 +8,10 @@
* - Implement formatters that present payment forms or totals/etc on entity view modes.
*
*/
-
/**
* Implements hook_field_info().
*/
-function pay_field_field_info() {
+function pay_field_info() {
// @todo finish populating this with pay formatters/widgets rather than text from example.
return array(
'pay_form' => array(
@@ -31,7 +30,7 @@ function pay_field_field_info() {
/**
* Implements hook_field_settings_form().
*/
-function pay_field_field_settings_form($field, $instance, $has_data) {
+function pay_field_settings_form($field, $instance, $has_data) {
die;
$settings = $field['settings'];
$form['max_length'] = array(
@@ -48,7 +47,7 @@ die;
/**
* Implements hook_field_schema().
*/
-function pay_field_field_schema($field = NULL) {
+function pay_field_schema($field = NULL) {
return array(
'columns' => array(
'pfid' => array(
@@ -69,7 +68,7 @@ function pay_field_field_schema($field = NULL) {
/**
* Implements hook_field_load().
*/
-function pay_field_field_load($entity_type, $entities, $field, $instances, $langcode, &$items, $age) {
+function pay_field_load($entity_type, $entities, $field, $instances, $langcode, &$items, $age) {
foreach ($entities as $id => $entity) {
foreach ($items[$id] as $delta => $item) {
// @todo finish this.

commit 8d61f4ec76ef3adf7cd2be6426325639e8c1e763
Author: Bryan Hirsch
Date: Sat Nov 12 15:15:07 2011 -0500

Added include for pay.field.inc. This makes 'payment form' field type available as a select option on manage fields pages.

diff --git a/pay.module b/pay.module
index 161fb68..46b95fa 100644
--- a/pay.module
+++ b/pay.module
@@ -6,6 +6,11 @@
*/

/**
+ * This include contains implementations of field hooks.
+ */
+require_once('pay.field.inc');
+
+/**
* Implements hook_init().
*/
function pay_init() {

commit 9b55b8b5e83c486d29079bd8b98a9dddea8564a2
Author: Bryan Hirsch
Date: Sat Nov 12 15:31:35 2011 -0500

Continue here. Figure out field settings and finish implementation of hook_field_settings_form.

diff --git a/pay.field.inc b/pay.field.inc
index 672989d..0debd05 100644
--- a/pay.field.inc
+++ b/pay.field.inc
@@ -31,7 +31,7 @@ function pay_field_info() {
* Implements hook_field_settings_form().
*/
function pay_field_settings_form($field, $instance, $has_data) {
-die;
+ debug('continue here');
$settings = $field['settings'];
$form['max_length'] = array(
'#type' => 'textfield',

allie micka’s picture

Status: Needs review » Closed (fixed)

Hi Bryan, You are made out of Rock. Thanks so much for working on this!

JRZ-2’s picture

Hello,

I'm sorry but I don't understand where to apply the patch... There's no pay.field.inc in the module archive. The patch doesn't apply.

Do you know if the D7 version is really complete ? How to attach a donate form to a node ? Can't figure out how. Thanks.

Thanks for your help.