11 years ago
2
Topic

Hi,

I'm creating a plugin to shuffle the contents of a field (mentioned it in other posts). I'm using this field for the article alias and my only issue with it is that when on Edit mode, it kicks in again and changes the alias (which is bad if the article was already shared. This was also mentioned in a different post). Here is the code I'm playing with now:

if ($value != $field->defaultvalue) {
$value=$field->value; }
else {
$value = $shuffler; }

This, in theory, should do the following:
1) Check to see if the field's value is it's default value. If it NOT the default value, keep value equal to whatever is currently filled into the field (presumably an alias).
2) If it IS the default value, then this is probably a brand new article, in which case, the value is $shuffler (my shuffle variable).

It seems that $value = $field->value is not working, nor is $field->value = $value. I'm doing this right before parent::g_onCCK_FieldPrepareStore_Validation, towards the end of the plugin.

So, how do I get $value equal to the stored/live/current value of $value?

Thanks!

Get a Book for SEBLOD
251 Posts
Viktor Iwan
11 years ago
1
Level 1

I assume you build a cck field.... If yes, then the field value is set on onCCK_FieldPrepareContent, have you look at this function before ?

11 years ago
0
Level 2

Thanks for the reply. I guess I'm still not clear on where in the file I should put my function.

It is a cck field plugin. I have a variable that is equal to the function, so in theory all I need to do is set the value of the plugin's field to that variable...but only if it's not in edit mode.

Can I send you my code for you to review? I've been running around in circles on this for a while.

Get a VIP membership