/** * Restrict content element ids. * * @param array $allowedElements List of allowed elements. * @param int $contentId The id of the current content element. * * @return void * @throws AccessDeniedException When an invalid content element type is accessed. */ private function restrictIds($allowedElements, $contentId) { $session = $this->session->getData(); $allowedElements = ArrayUtil::flatten($allowedElements); // Set allowed content element IDs (edit multiple) if (!empty($session['CURRENT']['IDS']) && is_array($session['CURRENT']['IDS'])) { $session['CURRENT']['IDS'] = $this->filterIds($session['CURRENT']['IDS'], $allowedElements); } // Set allowed clipboard IDs if (!empty($session['CLIPBOARD']['tl_content']['id'])) { $session['CLIPBOARD']['tl_content']['id'] = $this->filterIds((array) $session['CLIPBOARD']['tl_content']['id'], $allowedElements, 'sorting'); } // Overwrite session $this->session->setData($session); $this->guardAllowedAccess($allowedElements, $contentId); }