Subscriber Callback for the event.

@param \Drupal\Core\Config\ConfigCrudEvent $event
Configuration save event.

@throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
516112
public function onSavingConfig(ConfigCrudEvent $event) {
    // TODO: Find solution without global variable.
    global $_openy_config_import_event;
    $config = $event->getConfig();
    $original = $config->getOriginal();
    if (empty($original)) {
      // Skip new config.
      return;
    }
    $updated = $config->get();

    if ($original == $updated) {
      // Skip config without updates.
      return;
    }
    $config_name = $config->getName();
    $openy_configs = $this->upgradeLogManager->getOpenyConfigList();
    if (!in_array($config_name, $openy_configs)) {
      // Skip configs not related to Open Y.
      return;
    }
    if (!$_openy_config_import_event) {
      // This config was updated outside Open Y profile.
      $ignore = $this->upgradeLogManager->validateConfigDiff($config);
      if ($ignore) {
        // Skip tracking these changes according to ignore rules.
        // @see Plugin/ConfigEventIgnore
        return;
      }

      if (!$this->hasDiffFromOpenY($updated, $config_name)) {
        // No need to track customization if result config similar is to Open Y.
        return;
      }

      $this->upgradeLogManager->saveLoggerEntity($config_name, $updated);
      $this->logger->warning($this->t('You have manual updated @name config from Open Y profile.', ['@name' => $config_name]));
    }
    else {
      // Check if exist logger entity and enabled force mode.
      if ($this->upgradeLogManager->isForceMode() && $this->upgradeLogManager->isManuallyChanged($config_name, FALSE)) {
        $this->upgradeLogManager->createBackup($config_name);
      }
      $this->logger->info($this->t('Open Y has upgraded @name config.', ['@name' => $config_name]));
    }
  }
268065
public function onNewsletterSubscribeFlush(NewsletterSubscriptionEvent $event)
    {
        $subscription = $event->getNewsletterSubscription();

        $this->newsletterObjectManager->persist($subscription);
        $this->newsletterObjectManager->flush($subscription);
    }
465642
public function onChangeEmail(SubscriberEvent $event)
    {
        $this->listRepository->changeEmailAddress(
            $event->getListId(),
            $event->getSubscriber(),
            $event->getOldEmail()
        );
    }
896270
@Override
    public void configurationEvent(ConfigurationEvent event) {
        LOGGER.debug("event received : " + event.getPid() + " - " + event.getType());
        try {
            lock.lock();
            final List<InstanceDeclaration> impacted
                    = getDeclarationsByConfiguration(event.getPid(), event.getFactoryPid());

            if (impacted.isEmpty()) {
                return;
            }

            switch (event.getType()) {
                case ConfigurationEvent.CM_DELETED:
                    for (InstanceDeclaration declaration : impacted) {
                        LOGGER.info("Configuration " + event.getPid() + " deleted");
                        declaration.dispose(event.getPid());
                    }
                    break;
                case ConfigurationEvent.CM_UPDATED:
                    for (InstanceDeclaration declaration : impacted) {
                        final Configuration configuration = find(event.getPid());
                        if (configuration == null) {
                            LOGGER.error("Weird case, a matching declaration was found, but cannot be found a second " +
                                    "times, may be because of rapid changes in the config admin");
                        } else {
                            declaration.attachOrUpdate(configuration);
                        }
                    }

                    break;
            }
        } finally {
            lock.unlock();
        }

    }
227660
@Override
    public void onPluginEvent(PluginEvent event) {
        switch (event.getAction()) {
            case SUBSCRIBE: // Upon initial subscription, begin listening for specified generic events.
                plugin = event.getPlugin();
                doSubscribe(true);
                break;
            
            case LOAD: // Stop listening once loaded.
                plugin.unregisterListener(this);
                break;
            
            case UNSUBSCRIBE: // Stop listening for generic events once unsubscribed from plugin events.
                doSubscribe(false);
                break;
        }
    }
210805
public function onSubscriptionCreate(StripeSubscriptionCreateEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        $localSubscription = $event->getLocalSubscription();

        $result = $this->getStripeManager()->createSubscription($localSubscription);

        // Check if something went wrong
        if (false === $result) {
            // Stop progation
            $event->setStopReason($this->getStripeManager()->getError())->stopPropagation();

            // Dispatch a failed event
            $dispatcher->dispatch(StripeSubscriptionCreateEvent::FAILED, $event);

            // exit
            return;
        }

        $dispatcher->dispatch(StripeSubscriptionCreateEvent::CREATED, $event);
    }
271232
protected static function instantiateConsoleInteraction(Event $event) {
        $consoleIO                = $event->getIO();
        self::$consoleInteraction = new ConsoleInteraction(new Input($consoleIO), new Output($consoleIO));
    }
118653
public function dispatch( $event, $dispatchContext = null ) {

		$event = strtolower( $event );

		if ( !$this->hasEvent( $event ) && $this->throwOnMissingEvent ) {
			throw new EventNotDispatchableException( $event );
		} elseif( !$this->hasEvent( $event ) ) {
			return;
		}

		if ( is_array( $dispatchContext ) ) {
			$dispatchContext = DispatchContext::newFromArray( $dispatchContext );
		}

		foreach ( $this->dispatchableListeners[$event] as $listener ) {

			$listener->execute( $dispatchContext );

			if ( $listener->isPropagationStopped() || ( $dispatchContext !== null && $dispatchContext->isPropagationStopped() ) ) {
				break;
			}
		}
	}
268284
public function onPostSerialize(ObjectEvent $event)
    {
        // getSubscribedEvents doesn't seem to support parent classes
        if (!$event->getObject() instanceof MediaInterface) {
            return;
        }

        /** @var MediaInterface $media */
        $media = $event->getObject();

        $provider = $this->getProvider($media);

        if ($provider->getName() == 'image') {
            $images = $this->getImages($media, ['medialibrary']);

            $event->getVisitor()->addData('images', $images);
        }

        $event->getVisitor()->addData('original', $provider->getUrl($media));
    }
1180721
public function register($event, $callback)
	{
		// check if this is a valid event type
		if ( ! isset($this->callbacks[$event]))
		{
			throw new \InvalidArgumentException($event.' is not a valid event');
		}

		// check if the callback is acually callable
		if ( ! is_callable($callback))
		{
			throw new \InvalidArgumentException('Callback passed is not callable');
		}

		// store it
		$this->callbacks[$event][] = $callback;
	}
1070333
public function onConfigure(ConfigureWidgetEvent $event)
    {
        $instance = $event->getInstance();
        $config = $this->logManager->getLogConfig($instance);

        if ($config === null) {
            $config = new LogWidgetConfig();
            $config->setWidgetInstance($instance);
        }

        if ($instance->isDesktop()) {
            $workspaces = array();
            $workspacesVisibility = array();
            if (!$instance->isAdmin()) {
                $workspaces = $this->workspaceManager->getWorkspacesByUserAndRoleNames(
                    $instance->getUser(),
                    array('ROLE_WS_COLLABORATOR', 'ROLE_WS_MANAGER')
                );
                $workspacesVisibility = $this
                    ->logManager
                    ->getWorkspaceVisibilityForDesktopWidget($instance->getUser(), $workspaces);
            }

            $workspacesVisibility['amount'] = $config->getAmount();

            $form = $this
                ->formFactory
                ->create(
                    new LogDesktopWidgetConfigType(),
                    $workspacesVisibility,
                    array('workspaces' => $workspaces)
                );
            $content = $this->twig->render(
                'ClarolineCoreBundle:Log:config_desktop_widget_form.html.twig',
                array(
                    'form' => $form->createView(),
                    'instance' => $instance
                )
            );
        } else {
            $form    = $this->formFactory->create($this->logWorkspaceWidgetConfigForm, $config);
            $content = $this->twig->render(
                'ClarolineCoreBundle:Log:config_workspace_widget_form.html.twig',
                array(
                    'form'      => $form->createView(),
                    'instance' => $instance
                )
            );
        }

        $event->setContent($content);
    }
842063
public function observe($event)
	{
		foreach ($this->observers() as $observer => $settings)
		{
			$events = isset($settings['events']) ? $settings['events'] : array();
			if ((empty($events) or in_array($event, $events))
				and empty($this->_disabled_events[$event]))
			{
				if ( ! class_exists($observer))
				{
					$observer_class = \Inflector::get_namespace($observer).'Observer_'.\Inflector::denamespace($observer);
					if ( ! class_exists($observer_class))
					{
						throw new \UnexpectedValueException($observer);
					}

					// Add the observer with the full classname for next usage
					unset(static::$_observers_cached[$observer]);
					static::$_observers_cached[$observer_class] = $events;
					$observer = $observer_class;
				}

				try
				{
					call_user_func(array($observer, 'orm_notify'), $this, $event);
				}
				catch (\Exception $e)
				{
					// Unfreeze before failing
					$this->unfreeze();

					throw $e;
				}
			}
		}
	}
831712
public function addBrokenIndicatorOnPostSerialize(ObjectEvent $event)
    {
        $article = $event->getObject();
        $visitor = $event->getVisitor();

        if (!($article instanceof ArticleViewDocumentInterface)) {
            return;
        }

        $structure = $this->structureManager->getStructure($article->getStructureType(), 'article');
        $visitor->addData('broken', !$structure || $structure->getKey() !== $article->getStructureType());
        $visitor->addData('originalStructureType', $article->getStructureType());
    }
1005449
public function prepareConfig($event)
    {
        if (empty($this->batch_type)) {
            $this->batch_type = null;
        }
        if (isset($this->_configObject)) {
            if (!$this->configObject->validate()) {
                $this->addError('config', 'Invalid configuration');
                $event->isValid = false;
                return false;
            }
            try {
                $attributes = $this->configObject->attributes;
                unset($attributes['model']);
                $this->config = json_encode(['class' => get_class($this->configObject), 'attributes' => $attributes]);
            } catch (\Exception $e) {
                \d($this->_configObject);
                exit;
            }
        } else {
            $this->addError('config', 'Need to provide configuration for this subscription');
            $event->isValid = false;
            return false;
        }
    }
1288317
public function listen(Event $event)
    {
        if (!empty($this->handledEvents[$event->getName()])) {
            return;
        }
        $this->handledEvents[$event->getName()] = true;
        // Plugin has been uninstalled
        if (!file_exists(__FILE__) || !file_exists(__DIR__ . '/PluginImplementation.php')) {
            return;
        }

        // Load the implementation only after updating Composer so that we get
        // the new version of the plugin when a new one was installed
        if (null === $this->pluginImplementation) {
            $this->pluginImplementation = new PluginImplementation($event);
        }

        switch ($event->getName()) {
            case ScriptEvents::PRE_AUTOLOAD_DUMP:
                $this->pluginImplementation->preAutoloadDump();
                break;
            case ScriptEvents::POST_AUTOLOAD_DUMP:
                $this->pluginImplementation->postAutoloadDump();
                break;
        }
    }
242589
protected static function registerModelEvent($event, $callback)
    {
        $event = self::makeModelEventName($event);

        event()->listen($event, $callback);
    }
163028
public void registerListener(IPluginEventListener listener) {
        if (pluginEventListeners2 == null) {
            pluginEventListeners2 = new ArrayList<>();
        }

        if (!pluginEventListeners2.contains(listener)) {
            pluginEventListeners2.add(listener);
            listener.onPluginEvent(new PluginEvent(this, PluginAction.SUBSCRIBE));
        }
    }