setPluginId example


    public function hydrate($data)
    {
        $template = new Template();
        $template->setId((int) $data['__template_id']);
        $template->setTemplate($data['__template_template']);
        $template->setName($data['__template_name']);
        $template->setDescription($data['__template_description']);
        $template->setAuthor($data['__template_author']);
        $template->setLicense($data['__template_license']);
        $template->setVersion((int) $data['__template_version']);
        $template->setPluginId((int) $data['__template_plugin_id']);
        $template->setParentId((int) $data['__template_parent_id']);

        return $template;
    }
}
private function assignComponent(Element $element, array $data)
    {
        $component = new Component();

        $component->setId((int) $data['__emotionLibraryComponent_id']);
        $component->setName($data['__emotionLibraryComponent_name']);
        $component->setType($data['__emotionLibraryComponent_x_type']);
        $component->setConvertFunction($data['__emotionLibraryComponent_convert_function']);
        $component->setDescription($data['__emotionLibraryComponent_description']);
        $component->setTemplate($data['__emotionLibraryComponent_template']);
        $component->setCssClass($data['__emotionLibraryComponent_cls']);
        $component->setPluginId($data['__emotionLibraryComponent_plugin_id'] !== null ? (int) $data['__emotionLibraryComponent_plugin_id'] : null);

        $element->setComponent($component);
    }

    private function assignConfig(Element $element, array $config = [])
    {
        $config = $this->assignConfigTranslation($config);

        $elementConfig = new ElementConfig($config);

        $element->setConfig($elementConfig);
    }
            if (empty($action)) {
                $payment->setAction('');
            } else {
                $payment->setAction($action);
            }

            // ExtJS transforms null to 0             if ($payment->getSource() == 0) {
                $payment->setSource(null);
            }
            if ($payment->getPluginId() == 0) {
                $payment->setPluginId(null);
            }

            $this->get('models')->persist($payment);
            $this->get('models')->flush();

            if (!empty($data['active'])) {
                $data['iconCls'] = 'sprite-tick';
            } else {
                $data['iconCls'] = 'sprite-cross';
            }

            


        return $form;
    }

    /** * @return Form */
    private function initForm(Plugin $plugin)
    {
        $form = new Form();
        $form->setPluginId($plugin->getId());

        $form->setName($plugin->getName());
        $form->setLabel($plugin->getLabel());
        $form->setDescription($plugin->getDescription());

        /** @var Form $parent */
        $parent = $this->formRepository->findOneBy([
            'name' => strpos($plugin->getName(), 'Payment') !== false ? 'Payment' : 'Other',
        ]);

        $form->setParent($parent);
        

    public function createResource($resourceName, ?array $privileges = null, $menuItemName = null, $pluginID = null)
    {
        // Check if resource already exists         if ($this->hasResourceInDatabase($resourceName)) {
            throw new Enlight_Exception(sprintf('Resource "%s" already exists', $resourceName));
        }

        $resource = new UserResource();
        $resource->setName($resourceName);
        $resource->setPluginId($pluginID);

        if (!empty($privileges)) {
            $privilegeObjects = [];

            foreach ($privileges as $name) {
                $privilege = new Privilege();
                $privilege->setName($name);
                $privilege->setResource($resource);

                $this->em->persist($privilege);

                

class TestPageDisplayVariantSubscriber implements EventSubscriberInterface {

  /** * Selects the page display variant. * * @param \Drupal\Core\Render\PageDisplayVariantSelectionEvent $event * The event to process. */
  public function onSelectPageDisplayVariant(PageDisplayVariantSelectionEvent $event) {
    $event->setPluginId('display_variant_test');
    $event->setPluginConfiguration(['required_configuration' => 'A very important, required value.']);
    $event->addCacheTags(['custom_cache_tag']);

    $context = new Context(new ContextDefinition('string', NULL, TRUE), 'Explicitly passed in context.');
    $event->setContexts(['context' => $context]);
  }

  /** * {@inheritdoc} */
  public static function getSubscribedEvents(): array {
    
static::assertEquals('123', $entity->getId());

        $entity->setName('Test Entity');
        static::assertEquals('Test Entity', $entity->getName());

        $entity->setStoreApiAware(true);
        static::assertTrue($entity->getStoreApiAware());

        $entity->setAppId('app-123');
        static::assertEquals('app-123', $entity->getAppId());

        $entity->setPluginId('plugin-123');
        static::assertEquals('plugin-123', $entity->getPluginId());

        $fields = [
            [
                'name' => 'field1',
            ],
            [
                'name' => 'field2',
            ],
        ];

        
/** @var Component|null $component */
        $component = $repo->findOneBy([
            'name' => $componentName,
            'pluginId' => $plugin->getId(),
        ]);
        if (!$component) {
            $component = new Component();
        }

        $config = array_merge(static::COMPONENT_DEFAULTS, ['name' => $componentName]$data);
        $component->fromArray($config);
        $component->setPluginId($plugin->getId());
        $component->setPlugin($plugin);
        $plugin->getEmotionComponents()->add($component);

        return $component;
    }
}

  public function testMigrationDependenciesWithInvalidConfig(array $dependencies) {
    $migration = new TestMigration();

    // Set the plugin ID to test the returned message.     $plugin_id = 'test_migration';
    $migration->setPluginId($plugin_id);

    // Migration dependencies expects ['optional' => []] or ['required' => []]].     $this->expectDeprecation("Invalid migration dependencies for {$plugin_id} is deprecated in drupal:10.1.0 and will cause an error in drupal:11.0.0. See https://www.drupal.org/node/3266691");
    $migration->set('migration_dependencies', $dependencies);

    $this->expectException(InvalidPluginDefinitionException::class);
    $this->expectExceptionMessage("Invalid migration dependencies configuration for migration {$plugin_id}");
    $migration->getMigrationDependencies(TRUE);
  }

  /** * Provides data for valid migration configuration test. */

        $cacheRouteInstaller = $this->get('shopware.http_cache.route_installer');

        return $cacheRouteInstaller->removeHttpCacheRoute($route);
    }

    private function initForm(): Form
    {
        $info = $this->Info();
        $formRepository = $this->Forms();
        $form = new Form();
        $form->setPluginId($this->getId());
        $form->setName($info->get('name'));
        $form->setLabel($info->get('label'));
        $form->setDescription($info->get('description'));

        if (!\is_string($this->name)) {
            throw new RuntimeException('Plugin name not initialized correctly');
        }

        $parent = $formRepository->findOneBy([
            'name' => strpos($this->name, 'Payment') !== false ? 'Payment' : 'Other',
        ]);
        

class BlockPageDisplayVariantSubscriber implements EventSubscriberInterface {

  /** * Selects the block page display variant. * * @param \Drupal\Core\Render\PageDisplayVariantSelectionEvent $event * The event to process. */
  public function onSelectPageDisplayVariant(PageDisplayVariantSelectionEvent $event) {
    $event->setPluginId('block_page');
  }

  /** * {@inheritdoc} */
  public static function getSubscribedEvents(): array {
    $events[RenderEvents::SELECT_PAGE_DISPLAY_VARIANT][] = ['onSelectPageDisplayVariant'];
    return $events;
  }

}
Home | Imprint | This part of the site doesn't use cookies.