This forum is for module development and code related questions, not general module support. For general support, use the Post installation forum.

Create functions within module

Hello,

In the older versions of node_example, there used to be:

function node_example_menu($may_cache) {
$items = array();
if ($may_cache) {

What's that "may cache" for?

Merc.

Create functions within module

Hello,

I am developing my own module. I am sort-of "nearly there".

I need to make one function "callable" from the outside, passing the nid to it. It would have a URL assigned to it, obviously.

I also need to render a form starting from a $form variable.

Please let me know if you know how to do it.

Merc.

Cannot override taxonomy_term_page() function with phpTemplate?

I'm really lost on this one. I'm trying to override the taxonomy function taxonomy_term_page() in order to customize the look of my taxonomy/term/{tid} lists. I have done this already with product_view_collection() already and that works perfect. What makes this function any different?

This is what I have done:

template.php:

forms_api updated - what's "Cannot create references to/from string offsets nor overloaded objects"

I've tried updating a few modules to the new forms_api now, and I get stuck at the same point every time. I update all the arrays, set up the new hook, and every time I end up with the following error:
Fatal error: Cannot create references to/from string offsets nor overloaded objects in $my_drupal_dir/includes/form.inc on line 312

Here's an example of an update of the forms_api for the Donations module:
<?php
// Implementation of hook_settings()
function donations_settings()
{
$url_donorge = D_URL_DONORGE;
$donorge = "Donorge";
global $base_url;
$site_name = variable_get('site_name', 'drupal');

$form["donorge_default_item_id"] = array(
'#type' => 'textfield',
'#title' => "What is the item ID of your donation item as listed on Donorge?",
'#default_value' => variable_get('donorge_default_item_id', 1),
'#size' => 10,
'#maxlength' => 10,
'#description' => "",
);

$d_adminblock = l("enable a donation block", "admin/block");
$default_block_subject = variable_get('donorge_block_subject', "support $site_name");
$output .= "Optionally you can $d_adminblock which will make it allot easier for your visitors to donate to your item via your own site. Typically you should always enable the donation block on your site unless you want to manually take care of the donation button on your site.";
$form["donorge_block_subject"] = array(
'#type' => 'textfield',
'#title' => "Title of the donation block (optional)",
'#default_value' => variable_get('donorge_block_subject', $default_block_subject),
'#size' => 40,
'#maxlength' => 80,
'#description' => "",
);

$form["donorge_block_text"] = array(
'#type' => 'textarea',
'#title' => "This text appears on top of the donation button in the donations block (optional)",
'#default_value' => $default_block_text,
'#cols' => 64,
'#rows' => 8,
'#description' => "",
);

for($i = 1; $i < 19; $i++)
$options[] = $i;
$form["donorge_button_id"] = array(
'#type' => 'select',
'#title' => "Select the look of the donation button",
'#default_value' => variable_get('donorge_button_id', 1),
'#options' => $options,
'#description' => "",
);

$output .= "

";
for($i = 1; $i < 10; $i++) {
$ii = $i + 9;
$output .= "

";
}
$output .= "

$i. Only local images are allowed. $ii. Only local images are allowed.

Adding block_hook to my module causes ALL blocks to vanish...??

If I enable this function in my tapestries.module, all the blocks on my page just vanish. I stripped the function down to the point it does not actually DO anything, other than break the site. They still show up in the block configuration page, they just fail to display.

Check if the body has changed in node_update() - let's see if anybody knows this one!

Hello,

As many of you guys know :-) I am developing article_node.module. It's a node module that "enhanches" the normal node, so that peer reviewing can actually happen.

As you probably all know, I developed my own node_article_update($node) that does all the right stuff.

Now: I absolutely NEED to know if the body of the article has changed or not. This is very crucial, because I have to know if an author has actually changed an article (if s/he has, the article will go back to the editing pipeline).

Pages

Subscribe with RSS Subscribe to RSS - Module development and code questions