Welcome To Our Shell

Mister Spy & Souheyl Bypass Shell

Current Path : /var/www/html/pallets/web/core/modules/media/src/Plugin/EntityReferenceSelection/

Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
Upload File :
Current File : /var/www/html/pallets/web/core/modules/media/src/Plugin/EntityReferenceSelection/MediaSelection.php

<?php

namespace Drupal\media\Plugin\EntityReferenceSelection;

use Drupal\Core\Entity\Plugin\EntityReferenceSelection\DefaultSelection;

/**
 * Provides specific access control for the media entity type.
 *
 * @EntityReferenceSelection(
 *   id = "default:media",
 *   label = @Translation("Media selection"),
 *   entity_types = {"media"},
 *   group = "default",
 *   weight = 1
 * )
 */
class MediaSelection extends DefaultSelection {

  /**
   * {@inheritdoc}
   */
  protected function buildEntityQuery($match = NULL, $match_operator = 'CONTAINS') {
    $query = parent::buildEntityQuery($match, $match_operator);

    // Ensure that users with insufficient permission cannot see unpublished
    // entities.
    if (!$this->currentUser->hasPermission('administer media')) {
      $query->condition('status', 1);
    }
    return $query;
  }

  /**
   * {@inheritdoc}
   */
  public function createNewEntity($entity_type_id, $bundle, $label, $uid) {
    $media = parent::createNewEntity($entity_type_id, $bundle, $label, $uid);

    // In order to create a referenceable media, it needs to published.
    /** @var \Drupal\media\MediaInterface $media */
    $media->setPublished();

    return $media;
  }

  /**
   * {@inheritdoc}
   */
  public function validateReferenceableNewEntities(array $entities) {
    $entities = parent::validateReferenceableNewEntities($entities);
    // Mirror the conditions checked in buildEntityQuery().
    if (!$this->currentUser->hasPermission('administer media')) {
      $entities = array_filter($entities, function ($media) {
        /** @var \Drupal\media\MediaInterface $media */
        return $media->isPublished();
      });
    }
    return $entities;
  }

}

bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped)
Email: contact@elmoujehidin.net bypass 1.0, Devloped By El Moujahidin (the source has been moved and devloped) Email: contact@elmoujehidin.net