It's up to the view to concatinate the contents of this array, using something like implode(' | ', $meta)
public addMetaIf ( boolean | string | array $isAllowed, string $meta ) : MediaItemModule | ||
$isAllowed | boolean | string | array | Either a boolean to indicate whether to actually add the item or a permission string or array of permission strings (full match) to check. |
$meta | string | An HTML-formatted string. |
return | MediaItemModule | $this |
/** * Compiles theme info data into a media module. * * @param string $themeKey The theme key from the themeinfo array. * @param bool $isCurrent Whether the theme is the current theme (if so, adds a little current-theme flag when rendering). * @return MediaItemModule A media item representing the theme. * @throws Exception */ private function themeInfoToMediaItem($themeKey, $isCurrent = false) { $themeInfo = Gdn::themeManager()->getThemeInfo($themeKey); if (!$themeInfo) { throw new Exception(sprintf(t('Theme with key %s not found.'), $themeKey)); } $options = val('Options', $themeInfo, []); $iconUrl = val('IconUrl', $themeInfo, val('ScreenshotUrl', $themeInfo, "applications/dashboard/design/images/theme-placeholder.svg")); $themeName = val('Name', $themeInfo, val('Index', $themeInfo, $themeKey)); $themeUrl = val('ThemeUrl', $themeInfo, ''); $description = val('Description', $themeInfo, ''); $version = val('Version', $themeInfo, ''); $newVersion = val('NewVersion', $themeInfo, ''); $attr = []; if ($isCurrent) { $attr['class'] = 'media-callout-grey-bg'; } $media = new MediaItemModule($themeName, $themeUrl, $description, 'div', $attr); $media->setView('media-callout'); $media->addOption('has-options', !empty($options)); $media->addOption('has-upgrade', $newVersion != '' && version_compare($newVersion, $version, '>')); $media->addOption('new-version', val('NewVersion', $themeInfo, '')); $media->setImage($iconUrl); if ($isCurrent) { $media->addOption('is-current', $isCurrent); } // Meta // Add author meta $author = val('Author', $themeInfo, ''); $authorUrl = val('AuthorUrl', $themeInfo, ''); $media->addMetaIf($author != '', '<span class="media-meta author">' . sprintf('Created by %s', $authorUrl != '' ? anchor($author, $authorUrl) : $author) . '</span>'); // Add version meta $version = val('Version', $themeInfo, ''); $media->addMetaIf($version != '', '<span class="media-meta version">' . sprintf(t('Version %s'), $version) . '</span>'); // Add requirements meta $requirements = val('RequiredApplications', $themeInfo, []); $required = []; $requiredString = ''; if (!empty($requirements)) { foreach ($requirements as $requirement => $versionInfo) { $required[] = printf(t('%1$s Version %2$s'), $requirement, $versionInfo); } } if (!empty($required)) { $requiredString .= '<span class="media-meta requirements">' . t('Requires: ') . implode(', ', $required) . '</span>'; } $media->addMetaIf($requiredString != '', $requiredString); return $media; }