If you set the $node_field[0]['value'] to be an array, then PathAuto breaks on line 140 of pathauto.inc with error:

warning: mb_eregi_replace() expects parameter 3 to be string, array given in /var/www/html/example.com/sites/all/modules/pathauto/pathauto.inc on line 140.

Not entirely sure how to fix it...

Comments

Moonshine’s picture

Category: bug » support
Status: Active » Postponed (maintainer needs more info)

I'm surprised that's all that breaks! :) Setting a single field value to be an array would create chaos I would think.

Are you wanting to make a multi-valued field? In that case you would set the field to be multivalued in the CCK field setting form and set values in $node_field[0]['value'], $node_field[1]['value'], ....

mpavankumar’s picture

i get the same errors
* Warning: mb_eregi_replace() expects parameter 3 to be string, array given in pathauto_cleanstring()
* Warning: mb_strtolower() expects parameter 1 to be string, array given in drupal_strtolower()

Following the above suggestion i tried cck multivalue setting, but how can i get those values array in the display field? $node_field_item does not give all the values assigned to $node_field[0]['value'], $node_field[1]['value'], ....

nicholasthompson’s picture

Maybe 'value' shouldn't be an array, but using an array as a value for an item is very common (look at Filefield or Link, etc)... This should be possible, shouldn't it (untested)?

$node_field[0] = array('item1' => 1, 'item2' => 2, 'foo' => 'bar');
rajatgusain’s picture

@nicholas
I also used the pathauto module with multiple computed fields but I've not got any such type of issue.

I think you are missing the way to configure computed field I allowed no. of values 3 and assigned
3 values in the computed field text area like :-
$node_field[0]['value'] = "Rajat";
$node_field[1]['value'] = "Nitin";
$node_field[2]['value'] = "Mukul";

and in Display format I used
$display = $node_field_item['value'];

try this I hope your problem will be resolved.

Regards
Rajat Singh Gusain

amaisano’s picture

@nicholas
I'm after the same idea - trying to force the computed field to store more than just a single element ['value']. I am using the stable 1.0 release though - perhaps things have changed since then?

I've tried your test code, and the result is that unless one of the array keys is 'value,' the whole field get's a NULL for the 'value,' and all other array items are discarded.

Apparently Computed Field will simply not accept anything except a single string value - no other attributes allowed per item.

I've posed the question more in-depth here: #1547880: Store a multi-attribute array of values, instead of just one ['value']

dqd’s picture

Issue summary: View changes
Status: Postponed (maintainer needs more info) » Closed (won't fix)

Due to the Drupal core life cycle policy and security support advisery, Drupal 6 is no longer supported. So issues for Drupal 6 cannot be longer maintained. The project maintainer has asked for closing all D6 issues to clean up the issue queue. Feel free to reopen the issue if required or set it to "needs to be ported" and latest D8 dev version, if the issue discusses a still missing feature which can be implemented in the D8 version.

dqd’s picture

Status: Closed (won't fix) » Closed (outdated)