コード例 #1
0
 /**
  * Restrict the content elements.
  *
  * @param int  $contentId The id of the current content element.
  * @param Node $node      The node type.
  *
  * @return void
  * @throws AccessDeniedException When an invalid content element type is accessed.
  *
  * @SuppressWarnings(PHPMD.Superglobals)
  */
 public function restrict($contentId, Node $node = null)
 {
     $nodeType = $node ? $node->getName() : null;
     $allowedElements = $this->registry->filterContentElements($GLOBALS['TL_CTE'], $nodeType);
     if (empty($allowedElements)) {
         $this->closeDataContainer();
     } elseif (!in_array($this->definition->get('fields/type/default'), $allowedElements)) {
         $this->setDefaults($allowedElements);
     }
     if ($this->input->get('act') != '' && $this->input->get('act') !== 'select') {
         $GLOBALS['TL_CTE'] = $allowedElements;
         $this->restrictIds($allowedElements, $contentId);
     }
 }