Created
October 1, 2012 10:08
-
-
Save croxton/3810681 to your computer and use it in GitHub Desktop.
Better Workflow > Assets integration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In ft.assets.php add this to the top of the pre_process function: | |
/** | |
* Pre Process | |
*/ | |
function pre_process() | |
{ | |
// ------------------------------------------- | |
// Get the exp_assets_entries rows | |
// ------------------------------------------- | |
// BWF support | |
$from_bwf = FALSE; | |
if (isset($this->EE->session->cache['ep_better_workflow']) | |
&& isset($this->EE->session->cache['ep_better_workflow']['preview_entry_data'])) | |
{ | |
$draft_data = unserialize($this->EE->session->cache['ep_better_workflow']['preview_entry_data']->draft_data); | |
if (isset($draft_data['field_id_' . $this->field_id])) | |
{ | |
$draft_rows = $draft_data['field_id_' . $this->field_id]; | |
// build an array Assets can work with | |
$rows = array(); | |
foreach ($draft_rows as $key => $val) | |
{ | |
if ( ! is_array($val)) | |
{ | |
$rows[$key] = array(); | |
$rows[$key]['file_path'] = $val; | |
} | |
} | |
$from_bwf = TRUE; | |
} | |
} | |
if ( ! $from_bwf) | |
{ | |
// the original if/else conditional goes in here | |
} | |
// ------------------------------------------- | |
// Get the files | |
// ------------------------------------------- | |
// the function continues here... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Which Assets version is this for? I added this code and got an error when publishing a draft.