Add support for submitting extra field information (alt, title etc) with #1484992: Attach file to node targeted_action.

Comments

dolphinonmobile’s picture

StatusFileSize
new1.48 KB

Here is an example patch that tries to show a solution - adds the following changes:

  • Allows you to send extra field information to attach_file.

Example form element used to post files to attach_file:

<form action="site.com/endpoint/node/1234/attach_file" method="post" enctype="multipart/form-data">
  <input name="files[anything1]" type="file" />
  <input name="files[anything2]" type="file" />
  <input name="field_name" type="text" value="field_image" />
  <input name="attach" type="text" value="0" />

Patch allows you to add:

  <input name="field_values[anything1][alt]" type="text" />
  <input name="field_values[anything1][title]" type="text" />
  <input name="field_values[anything1][custom_field]" type="text" />
  <input name="field_values[anything2][alt]" type="text" />
  <input name="field_values[anything2][title]" type="text" />
  <input name="field_values[anything2][custom_field]" type="text" />

Which will be appended to the created file object:

  $file_obj->alt
  $file_obj->title
  $file_obj->custom_field
  ...
dolphinonmobile’s picture

Status: Active » Needs review
kylebrowning’s picture

Status: Needs review » Closed (fixed)

Commited, thanks!