/**
  * Render a node label
  *
  * @param NodeInterface $node
  * @param boolean $crop This argument is deprecated as of Neos 1.2 and will be removed. Don't rely on this behavior and crop labels in the view.
  * @return string
  */
 public function getLabel(NodeInterface $node, $crop = true)
 {
     $label = Utility::evaluateEelExpression($this->getExpression(), $this->eelEvaluator, array('node' => $node), $this->defaultContextConfiguration);
     if ($crop === false) {
         return $label;
     }
     $croppedLabel = Functions::substr($label, 0, 30);
     return $croppedLabel . (strlen($croppedLabel) < strlen($label) ? ' …' : '');
 }
コード例 #2
0
 /**
  * Record events for entity changes.
  *
  * Note: this method is registered as an Doctrine event listener in the settings of this package.
  *
  * TODO: Update/Delete of Entities
  *
  * @param OnFlushEventArgs $eventArgs
  * @return void
  * @throws Exception
  */
 public function onFlush(OnFlushEventArgs $eventArgs)
 {
     if (!$this->eventEmittingService->isEnabled()) {
         return;
     }
     $entityManager = $eventArgs->getEntityManager();
     $unitOfWork = $entityManager->getUnitOfWork();
     foreach ($unitOfWork->getScheduledEntityInsertions() as $entity) {
         $className = get_class($entity);
         if (isset($this->monitorEntitiesSetting[$className])) {
             $entityMonitoringConfiguration = $this->monitorEntitiesSetting[$className];
             if (isset($entityMonitoringConfiguration['events']['created'])) {
                 $this->initializeAccountIdentifier();
                 $data = array();
                 foreach ($entityMonitoringConfiguration['data'] as $key => $eelExpression) {
                     $data[$key] = Utility::evaluateEelExpression($eelExpression, $this->eelEvaluator, array('entity' => $entity));
                 }
                 $event = $this->eventEmittingService->emit($entityMonitoringConfiguration['events']['created'], $data);
                 $unitOfWork->computeChangeSet($entityManager->getClassMetadata(Event::class), $event);
             }
         }
     }
     foreach ($unitOfWork->getScheduledEntityDeletions() as $entity) {
         $className = get_class($entity);
         if (isset($this->monitorEntitiesSetting[$className])) {
             $entityMonitoringConfiguration = $this->monitorEntitiesSetting[$className];
             if (isset($entityMonitoringConfiguration['events']['deleted'])) {
                 $this->initializeAccountIdentifier();
                 $data = array();
                 foreach ($entityMonitoringConfiguration['data'] as $key => $eelExpression) {
                     $data[$key] = Utility::evaluateEelExpression($eelExpression, $this->eelEvaluator, array('entity' => $entity));
                 }
                 $event = $this->eventEmittingService->emit($entityMonitoringConfiguration['events']['deleted'], $data);
                 $unitOfWork->computeChangeSet($entityManager->getClassMetadata(Event::class), $event);
             }
         }
     }
 }
コード例 #3
0
 /**
  * Get variables from configuration that should be set in the context by default.
  * For example Eel helpers are made available by this.
  *
  * @return array Array with default context variable objects.
  */
 protected function getDefaultContextVariables()
 {
     if ($this->defaultContextVariables === null) {
         $this->defaultContextVariables = array();
         if (isset($this->settings['defaultContext']) && is_array($this->settings['defaultContext'])) {
             $this->defaultContextVariables = EelUtility::getDefaultContextVariables($this->settings['defaultContext']);
         }
         $this->defaultContextVariables['request'] = $this->controllerContext->getRequest();
     }
     return $this->defaultContextVariables;
 }