Note the upgraded forum! If you are experiencing issues logging in, you may need to reset your password which should send an email. If the email doesn't arrive, be sure to check your spam folder just in case.

custom actions in embedded field getting mangled

A bit new to Fuel CMS and I'm trying to add custom actions to an embedded field, but upon refreshing the list with ajax, the custom action array is getting mangled, but I don't know why.

This is my field definition:

'actions' => array('edit','delete','custom' => array(
         'faceoff-child/move-up/{id}' => 'UP',
         'faceoff-child/move-down/{id}' => 'DOWN',
)),

I tried a vardump in the ajax_embedded_list_items function and this is what I'm getting:

array (size=3)
  0 => string 'edit' (length=4)
  1 => string 'delete' (length=6)
  'custom' => 
    array (size=1)
      0 => string 'DOWN' (length=4)

So it looks like a parser is stripping my array keys. The form data sent looks like this in the browser:

actions[0]: edit
actions[1]: delete
actions[custom][faceoff-child/move-up/{id}]: UP
actions[custom][faceoff-child/move-down/{id}]: DOWN

Comments

  • What about if you do it like this?

    'actions' => array('edit','delete',
             'faceoff-child/move-up/{id}' => 'UP',
             'faceoff-child/move-down/{id}' => 'DOWN',
    ),
    
  • Still doesn't work. I ran xdebug on this and it seems that as soon as the core Input class is loaded (from CI), the $_POST variable gets changed. It doesn't like the array key "faceoff-child/move-down/{id}"

    Digging deeper, I found that it's an issue with this older version of CI being used. The solution is to create a MY_Input.php file, as mentioned here:

    https://stackoverflow.com/a/18216894/729440

    and add curly brackets to the allowed list of characters. I'm actually contemplating simply turning off this function, since it was removed from later version of CI due to all the problems it had.

Sign In or Register to comment.