We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Extension - overwrite values in an entry before submitting

Development and Programming

Erik_H's avatar
Erik_H
2 posts
15 years ago
Erik_H's avatar Erik_H

Hi,

This post is somewhat related to http://ellislab.com/forums/viewthread/168669/, but I am posting here as the questions are of development nature and focused on a few spesific issues as opposed to the more general questions in the previous post. I’m running expressionengine 2.x

I’ve got an extension that takes a channel entry during the ‘entry_submission_ready’ phase and checks the file field for the image path.

function blend_image($metaData, $dataValues, $autosave){.....}

It then takes that image along with a background image and does some post-processing with the GD library to merge the images together and save the new image. I’ve verified that the new image gets created and is in the same upload directory as the original image. However I can’t seem to find a way to substitute the original value in the file field with the new url. I’ve tried setting the value in $dataValues and even tried passing $dataValues as reference to see if that helped, but to no avail. Is there any way of passing the new value on to the entry that is about to be made or do I actually have to look into the submitting entry first, then re-update it?

Second extension I have is doing something similar. It looks at an entry I’ve just submitted during the ‘entry_submission_end’ phase and checks a file field for the image url. It then checks the entries in a different channel ( for images ) to see if the url already exists. If it doesn’t it will create a new entry for the image. The problem I have here is that calling

($this->EE->api_channel_entries->submit_new_entry( $image_channel_id, $data)

yields the following

An Error Occurred Creating the Entry:

Array
(
    [Heading] => The following field is required:
    [Text] => The following field is required:
)

These values are NOT part of the image channel ( and id is set correctly ) but rather the news channel. So it seems to me that it for some reason expects values from the entry I’ve called the extension from. Is this an issue with the table model having all field_ids and it can’t distinguish between models? (In other words, do I need to add all required fields regardless and pass null values to those not relevant for channel? )

Hope someone has an answer or know which pages/post to direct me to for more information.

Cheers.

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.