You are here

class MetadataInfoEventSubscriber in Filebrowser 3.x

Same name in this branch
  1. 3.x src/EventSubscriber/MetadataInfoEventSubscriber.php \Drupal\filebrowser\EventSubscriber\MetadataInfoEventSubscriber
  2. 3.x modules/src/EventSubscriber/MetadataInfoEventSubscriber.php \Drupal\filebrowser_extra\EventSubscriber\MetadataInfoEventSubscriber
Same name and namespace in other branches
  1. 8.2 src/EventSubscriber/MetadataInfoEventSubscriber.php \Drupal\filebrowser\EventSubscriber\MetadataInfoEventSubscriber

Hierarchy

Expanded class hierarchy of MetadataInfoEventSubscriber

1 string reference to 'MetadataInfoEventSubscriber'
filebrowser.services.yml in ./filebrowser.services.yml
filebrowser.services.yml
1 service uses MetadataInfoEventSubscriber
filebrowser.metadata_info in ./filebrowser.services.yml
Drupal\filebrowser\EventSubscriber\MetadataInfoEventSubscriber

File

src/EventSubscriber/MetadataInfoEventSubscriber.php, line 11

Namespace

Drupal\filebrowser\EventSubscriber
View source
class MetadataInfoEventSubscriber implements EventSubscriberInterface {
  use StringTranslationTrait;

  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents() {
    $events['filebrowser.metadata_info'][] = [
      'setInfo',
      0,
    ];
    return $events;
  }
  public function setInfo($event) {

    /** @var MetadataInfo $event */
    $info = [
      Common::ICON => [
        'title' => $this
          ->t('Icon'),
      ],
      Common::NAME => [
        'title' => $this
          ->t('Name'),
        'sortable' => TRUE,
        'type' => 'string',
      ],
      Common::CREATED => [
        'title' => $this
          ->t('Created'),
        //'sortable' => TRUE,
        'type' => 'integer',
      ],
      Common::SIZE => [
        'title' => $this
          ->t('Size'),
        // fixme: formatted size not sortable
        'sortable' => false,
        'type' => 'integer',
      ],
      Common::MIME_TYPE => [
        'title' => $this
          ->t('Mime type'),
        'sortable' => TRUE,
        'type' => 'string',
      ],
      Common::DESCRIPTION => [
        'title' => $this
          ->t('Description'),
        'writable' => TRUE,
        //'sortable' => TRUE,
        'type' => 'string',
      ],
    ];
    $event
      ->setMetaDataInfo($info);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
MetadataInfoEventSubscriber::getSubscribedEvents public static function
MetadataInfoEventSubscriber::setInfo public function
StringTranslationTrait::$stringTranslation protected property The string translation service. 4
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.