function iss_field_attach_submit in Image Style Selector 7.2
Implements hook_field_attach_submit().
File
- ./
iss.module, line 190
Code
function iss_field_attach_submit($entity_type, $entity, $form, &$form_state) {
$instances = field_info_instances($entity_type, $form['#bundle']);
foreach ($instances as $instance) {
$field_name = $instance['field_name'];
$field = field_info_field($field_name);
$available_languages = field_available_languages($entity_type, $field);
$languages = _field_language_suggestion($available_languages, NULL, $field_name);
foreach ($languages as $langcode) {
$items = isset($entity->{$field_name}[$langcode]) ? $entity->{$field_name}[$langcode] : array();
foreach ($items as $item) {
if (!empty($item['iss'])) {
$fid = $item['fid'];
$iss_data = $item['iss'];
$file = file_load($fid);
$file->iss_styles = $iss_data['iss_styles'];
file_save($file);
}
}
}
}
}