Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use image meta title information as filename #74

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Use image meta title information as filename
If files are imported it is better to check for a title information and use it as to use the filename.
  • Loading branch information
philipp-winterle committed Apr 21, 2016
commit 88d0be66ca2c2de24432fe9a6b26f4db39dd9a77
17 changes: 12 additions & 5 deletions Classes/Domain/Import/AbstractImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -350,15 +350,22 @@ protected function importFileByFilename($filePath, $item = NULL) {
* @return Tx_Yag_Domain_Model_Item $item;
*/
protected function processStringFromMetaData(Tx_Yag_Domain_Model_Item $item, $format, $additionalVars = array()) {

$vars = array();
$metaTitle = null;

if($item->getItemMeta() instanceof Tx_Yag_Domain_Model_ItemMeta) {
$vars = $item->getItemMeta()->getAttributeArray();
} else {
$vars = array();
}
$metaTitle = $item->getItemMeta()->getTitle();
}

if (isset($metaTitle) && !empty($metaTitle)) {
$fileName = $metaTitle;
} else {
$fileName = $this->processTitleFromFileName($item->getOriginalFilename());
}

$vars['origFileName'] = $item->getOriginalFilename();
$vars['fileName'] = $this->processTitleFromFileName($item->getOriginalFilename());
$vars['fileName'] = $fileName;

$vars = \TYPO3\CMS\Extbase\Utility\ArrayUtility::arrayMergeRecursiveOverrule($vars, $additionalVars);
$formattedString = Tx_PtExtlist_Utility_RenderValue::renderDataByConfigArray($vars, $format);
Expand Down