mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-07 00:44:36 +02:00
Fixed code style.
This commit is contained in:
parent
1aed1d1d26
commit
9a7223a301
142 changed files with 534 additions and 716 deletions
|
@ -21,21 +21,16 @@
|
|||
|
||||
namespace App\DataTables\Column;
|
||||
|
||||
|
||||
use App\Entity\Attachments\Attachment;
|
||||
use App\Entity\Parts\Part;
|
||||
use App\Services\Attachments\AttachmentManager;
|
||||
use App\Services\Attachments\AttachmentURLGenerator;
|
||||
use App\Services\EntityURLGenerator;
|
||||
use App\Services\FAIconGenerator;
|
||||
use Omines\DataTablesBundle\Column\AbstractColumn;
|
||||
use Symfony\Component\OptionsResolver\OptionsResolver;
|
||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||
|
||||
|
||||
class PartAttachmentsColumn extends AbstractColumn
|
||||
{
|
||||
|
||||
protected $FAIconGenerator;
|
||||
protected $urlGenerator;
|
||||
protected $attachmentManager;
|
||||
|
@ -51,6 +46,7 @@ class PartAttachmentsColumn extends AbstractColumn
|
|||
* The normalize function is responsible for converting parsed and processed data to a datatables-appropriate type.
|
||||
*
|
||||
* @param mixed $value The single value of the column
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function normalize($value)
|
||||
|
@ -63,7 +59,7 @@ class PartAttachmentsColumn extends AbstractColumn
|
|||
if (!$context instanceof Part) {
|
||||
throw new \RuntimeException('$context must be a Part object!');
|
||||
}
|
||||
$tmp = "";
|
||||
$tmp = '';
|
||||
$attachments = $context->getAttachments()->filter(function (Attachment $attachment) {
|
||||
return $attachment->getShowInTable() && $this->attachmentManager->isFileExisting($attachment);
|
||||
});
|
||||
|
@ -74,11 +70,11 @@ class PartAttachmentsColumn extends AbstractColumn
|
|||
if (--$count < 0) {
|
||||
break;
|
||||
}
|
||||
/** @var Attachment $attachment */
|
||||
/* @var Attachment $attachment */
|
||||
$tmp .= sprintf(
|
||||
'<a href="%s" title="%s" class="attach-table-icon" target="_blank" rel="noopener" data-no-ajax>%s</a>',
|
||||
$this->urlGenerator->viewURL($attachment),
|
||||
htmlspecialchars($attachment->getName()) . ': ' . htmlspecialchars($attachment->getFilename()),
|
||||
htmlspecialchars($attachment->getName()).': '.htmlspecialchars($attachment->getFilename()),
|
||||
$this->FAIconGenerator->generateIconHTML(
|
||||
// Sometimes the extension can not be determined, so ensure a generic icon is shown
|
||||
$this->FAIconGenerator->fileExtensionToFAType($attachment->getExtension() ?? 'file'),
|
||||
|
@ -95,4 +91,4 @@ class PartAttachmentsColumn extends AbstractColumn
|
|||
{
|
||||
parent::configureOptions($resolver);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue