D7 module FieldException error using field_create_instance()

Hi

I am evaluating D7 and writing a test module in order to help with the learning curve.

Basically its using an Annotate tutorial which allows people to comment on nodes. It adds a comments field to types of my choosing.

Following a tutorial from Apress Pro Drupal 7 Development and tweaking it to suit.

The hook in question is this...

<?php
function script_injector_admin_settings_submit(&$form, $form_state){

$types = $form_state['values']['script_injector_node_types'];

$field = array(
'field_name'=>'script_injector',
'entity_type'=>'node',
'bundle'=>$key,
'label'=>t('Script'),
'widget_type'=>'text_textarea_with_summary',
'settings'=>array('display_summary'=>TRUE),
);

foreach($types as $key => $value){

if($value === 0){

$instance = field_info_instance('node', 'script_injector', $key);

if(!empty($instance)){

field_delete_instance($instance,false);

watchdog("Script Injector", 'Deleted a Script Injector Field from content type: %key', array('%key'=>$key));
}

}else{

Chicago Drupalcon ticket for sale

I thought I will be able to attend the Drupalcon but was struck with a sudden tragedy. Offers invited for anyone who would like to use the ticket which cost me $350 . Any reasonable offer and I will immediately arrange for the transfer. Thanks.

php.ini settings of memory_limit, upload_max_filesize and post_max_size for large uploads

I'm trying to configure a server to accept very large uploads (1g). I think I've got the relationship between post size and max file size and the need to configure adequate script running time under control; however, I'm not clear on the the relationship between memory_limit to max post/file size.

The handbook page references the php documentation saying:

Generally speaking, memory_limit should be larger than post_max_size. When an integer is used, the value is measured in bytes.

However this stackoverflow answer claims that it is not necessary to set memory_limit greater than upload_max_filesize/post_max_size referencing the php source.

The StackOverflow answer seems to match my experience of working with uploaded files in php (i.e. moving the file from tmp instead of writing $_FILES to disk). Additionally I've currently got uploads capped at 1g and memory capped at 256m with everything appearing to work; however, I'm concerned about unforeseen ramifications of these settings given the documentation.

Node shown on all pages

Hi all,

I have this common problem. I want the site admin (not me, the super admin) give the ability to have contact information in the footer, and have the ability to post a little 'ad'. But how to do this?

I already know there are modules like nodeblock, and panels, but maybe you can show me a simple tutorial on how to do this?

Best regards, Geert

How can I learn Views API?

Hi,
where can I find views API? I want to learn adding my custom filters to views queries.

specifically, I want to create CCK field with multiple values (as for example location CCK field has more values - longitude, latidute, city and so on). I need all these values to be available as filters in views.

How can I create CCK field in that way that it has more values and all of them can be views filters?

thanks for any advice
Tomas

Transferring from xoops to dropal and also saving material

hello,
i am a xoops user and i am interested in transferring my website to the latest version of drupal. I want to transfer the data of the xoops site to drupal without any loss. The data (and the version) that i want to be saved are:

users - system (about 2.000 users)
news 1.63 (about 15.000 posts)
comments - system (about 2.000)

xoops version 2.3.2.

i am also interested in converting the encoding from greek iso 8859-7 to utf-8

Pages

Subscribe with RSS Subscribe to RSS - Drupal 7.x