/** * @param \Iterator|\TYPO3\CMS\Extbase\DomainObject\AbstractEntity[] $iterator * @return array */ protected function getStructure($iterator) { $structure = array(); if (!$iterator instanceof \Iterator) { $iterator = array($iterator); } foreach ($iterator as $entity) { $dataMap = $this->dataMapFactory->buildDataMap(get_class($entity)); $tableName = $dataMap->getTableName(); $identifier = $tableName . ':' . $entity->getUid(); $properties = \TYPO3\CMS\Extbase\Reflection\ObjectAccess::getGettableProperties($entity); $structureItem = array(); foreach ($properties as $propertyName => $propertyValue) { $columnMap = $dataMap->getColumnMap($propertyName); if ($columnMap !== NULL) { $propertyName = $columnMap->getColumnName(); } if ($propertyValue instanceof \Iterator) { $structureItem[$propertyName] = $this->getStructure($propertyValue); } else { $structureItem[$propertyName] = $propertyValue; } } $structure[$identifier] = $structureItem; } return $structure; }
/** * @return mixed */ public function render() { $nodes = array(); foreach ($this->childViewHelperNodes as $viewHelperNode) { $viewHelper = $viewHelperNode->getUninitializedViewHelper(); $arguments = $viewHelper->prepareArguments(); $givenArguments = $viewHelperNode->getArguments(); $viewHelperReflection = new \ReflectionClass($viewHelper); $viewHelperDescription = $viewHelperReflection->getDocComment(); $viewHelperDescription = htmlentities($viewHelperDescription); $viewHelperDescription = '[CLASS DOC]' . LF . $viewHelperDescription . LF; $renderMethodDescription = $viewHelperReflection->getMethod('render')->getDocComment(); $renderMethodDescription = htmlentities($renderMethodDescription); $renderMethodDescription = implode(LF, array_map('trim', explode(LF, $renderMethodDescription))); $renderMethodDescription = '[RENDER METHOD DOC]' . LF . $renderMethodDescription . LF; $argumentDefinitions = array(); foreach ($arguments as &$argument) { $name = $argument->getName(); $argumentDefinitions[$name] = ObjectAccess::getGettableProperties($argument); } $sections = array($viewHelperDescription, DebuggerUtility::var_dump($argumentDefinitions, '[ARGUMENTS]', 4, TRUE, FALSE, TRUE), DebuggerUtility::var_dump($givenArguments, '[CURRENT ARGUMENTS]', 4, TRUE, FALSE, TRUE), $renderMethodDescription); array_push($nodes, implode(LF, $sections)); } return '<pre>' . implode(LF . LF, $nodes) . '</pre>'; }
/** * Extends a given default ControllerContext. * * @param \TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext * @return ControllerContext */ public static function extend(\TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext $source) { $controllerContext = \TYPO3\CMS\Form\Utility\FormUtility::getObjectManager()->get(ControllerContext::class); $propertyNames = ObjectAccess::getGettableProperties($source); foreach ($propertyNames as $propertyName => $propertyValue) { ObjectAccess::setProperty($controllerContext, $propertyName, $propertyValue); } return $controllerContext; }
/** * Duplicates (all public accessable properties) the given registration the * amount of times configured in amountOfRegistrations * * @param \DERHANSEN\SfEventMgt\Domain\Model\Registration $registration Registration * * @return void */ public function createDependingRegistrations($registration) { $registrations = $registration->getAmountOfRegistrations(); for ($i = 1; $i <= $registrations - 1; $i++) { /** @var \DERHANSEN\SfEventMgt\Domain\Model\Registration $newReg */ $newReg = $this->objectManager->get('DERHANSEN\\SfEventMgt\\Domain\\Model\\Registration'); $properties = ObjectAccess::getGettableProperties($registration); foreach ($properties as $propertyName => $propertyValue) { ObjectAccess::setProperty($newReg, $propertyName, $propertyValue); } $newReg->setMainRegistration($registration); $newReg->setAmountOfRegistrations(1); $newReg->setIgnoreNotifications(TRUE); $this->registrationRepository->add($newReg); } }
/** * Makes an array out of all public getter methods * * @param boolean $camelCaseKeys If set to false the array keys are TYPO3 cObj compatible * * @return array */ public function toArray($camelCaseKeys = FALSE) { $camelCaseProperties = ObjectAccess::getGettableProperties($this); if ($camelCaseKeys === TRUE) { return $camelCaseProperties; } $data = array(); foreach ($camelCaseProperties as $camelCaseFieldKey => $value) { $fieldKey = strtolower(preg_replace('/([a-z])([A-Z])/', '$1_$2', $camelCaseFieldKey)); // TYPO3 cObj edge case if ($camelCaseFieldKey === 'cType') { $fieldKey = ucfirst($camelCaseFieldKey); } $data[$fieldKey] = $value; } return $data; }
/** * Renders the TypoScript object in the given TypoScript setup path. * * @param string $typoscriptObjectPath the TypoScript setup path of the TypoScript object to render * @param mixed $data the data to be used for rendering the cObject. Can be an object, array or string. If this argument is not set, child nodes will be used * @param string $currentValueKey * @param string $table * @throws \TYPO3\CMS\Fluid\Core\ViewHelper\Exception * @return string the content of the rendered TypoScript object */ public function render() { $this->configurationManager = GeneralUtility::makeInstance('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager'); $this->typoScriptSetup = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT); $data = isset($this->arguments['data']) ? $this->arguments['data'] : array(); $currentValueKey = isset($this->arguments['currentValueKey']) ? $this->arguments['currentValueKey'] : null; $table = isset($this->arguments['table']) ? $this->arguments['table'] : ''; $typoscriptObjectPath = $this->arguments['tspath']; if (TYPO3_MODE === 'BE') { $this->simulateFrontendEnvironment(); } $currentValue = null; if (is_object($data)) { $data = \TYPO3\CMS\Extbase\Reflection\ObjectAccess::getGettableProperties($data); } elseif (is_string($data) || is_numeric($data)) { $currentValue = (string) $data; $data = array($data); } /** @var \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $contentObject */ $contentObject = GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class); $contentObject->start($data, $table); if ($currentValue !== null) { $contentObject->setCurrentVal($currentValue); } elseif ($currentValueKey !== null && isset($data[$currentValueKey])) { $contentObject->setCurrentVal($data[$currentValueKey]); } $pathSegments = GeneralUtility::trimExplode('.', $typoscriptObjectPath); $lastSegment = array_pop($pathSegments); $setup = $this->typoScriptSetup; foreach ($pathSegments as $segment) { if (!array_key_exists($segment . '.', $setup)) { //throw new \TYPO3\CMS\Fluid\Core\ViewHelper\Exception('TypoScript object path "' . htmlspecialchars($typoscriptObjectPath) . '" does not exist', 1253191023); // TODO #exception } $setup = $setup[$segment . '.']; } $content = $contentObject->cObjGetSingle($setup[$lastSegment], $setup[$lastSegment . '.']); if (TYPO3_MODE === 'BE') { $this->resetFrontendEnvironment(); } return $content; }
/** * render * * @param string $class * @param string $table * @param object $data * @return array */ public function render($class = '', $table = '', $data) { $configurationManager = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Configuration\\ConfigurationManager'); $conf = $configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK); if (isset($conf['persistence']['classes'][$class]['mapping']) && $conf['persistence']['classes'][$class]['mapping']['tableName'] == $table) { $mapping = []; foreach ($conf['persistence']['classes'][$class]['mapping']['columns'] as $tableColumn => $modelPropertyData) { $modelProperty = $modelPropertyData['mapOnProperty']; $mapping[$modelProperty] = $tableColumn; } $data = \TYPO3\CMS\Extbase\Reflection\ObjectAccess::getGettableProperties($data); foreach ($data as $key => $value) { if (isset($mapping[$key])) { unset($data[$key]); $data[$mapping[$key]] = $value; } } return $data; } else { return $data; } }
/** * Get from TypoScript content object like * * # direct value * plugin.tx_powermail.settings.setup.prefill.marker = TEXT * plugin.tx_powermail.settings.setup.prefill.marker.value = red * * # multiple value * plugin.tx_powermail.settings.setup.prefill.marker.0 = TEXT * plugin.tx_powermail.settings.setup.prefill.marker.0.value = red * * @return array|string */ protected function getFromTypoScriptContentObject() { $value = ''; if (isset($this->settings['prefill.'][$this->getMarker() . '.']) && is_array($this->settings['prefill.'][$this->getMarker() . '.'])) { $this->contentObjectRenderer->start(ObjectAccess::getGettableProperties($this->getField())); // Multivalue if (isset($this->settings['prefill.'][$this->getMarker() . '.']['0'])) { $value = array(); foreach (array_keys($this->settings['prefill.'][$this->getMarker() . '.']) as $key) { if (stristr($key, '.')) { continue; } $value[] = $this->contentObjectRenderer->cObjGetSingle($this->settings['prefill.'][$this->getMarker() . '.'][$key], $this->settings['prefill.'][$this->getMarker() . '.'][$key . '.']); } } else { // Single value $value = $this->contentObjectRenderer->cObjGetSingle($this->settings['prefill.'][$this->getMarker()], $this->settings['prefill.'][$this->getMarker() . '.']); } } return $value; }
/** * Renders the TypoScript object in the given TypoScript setup path. * * @param string $typoscriptObjectPath the TypoScript setup path of the TypoScript object to render * @param mixed $data the data to be used for rendering the cObject. Can be an object, array or string. If this argument is not set, child nodes will be used * @param string $currentValueKey * @param string $table * @throws \TYPO3\CMS\Fluid\Core\ViewHelper\Exception * @return string the content of the rendered TypoScript object */ public function render($typoscriptObjectPath, $data = null, $currentValueKey = null, $table = '') { if (TYPO3_MODE === 'BE') { $this->simulateFrontendEnvironment(); } if ($data === null) { $data = $this->renderChildren(); } $currentValue = null; if (is_object($data)) { $data = \TYPO3\CMS\Extbase\Reflection\ObjectAccess::getGettableProperties($data); } elseif (is_string($data) || is_numeric($data)) { $currentValue = (string) $data; $data = array($data); } /** @var \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $contentObject */ $contentObject = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class); $contentObject->start($data, $table); if ($currentValue !== null) { $contentObject->setCurrentVal($currentValue); } elseif ($currentValueKey !== null && isset($data[$currentValueKey])) { $contentObject->setCurrentVal($data[$currentValueKey]); } $pathSegments = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode('.', $typoscriptObjectPath); $lastSegment = array_pop($pathSegments); $setup = $this->typoScriptSetup; foreach ($pathSegments as $segment) { if (!array_key_exists($segment . '.', $setup)) { throw new \TYPO3\CMS\Fluid\Core\ViewHelper\Exception('TypoScript object path "' . htmlspecialchars($typoscriptObjectPath) . '" does not exist', 1253191023); } $setup = $setup[$segment . '.']; } $content = $contentObject->cObjGetSingle($setup[$lastSegment], $setup[$lastSegment . '.']); if (TYPO3_MODE === 'BE') { $this->resetFrontendEnvironment(); } return $content; }
/** * @test */ public function getGettablePropertiesReturnsPropertiesOfStdClass() { $stdClassObject = new \stdClass(); $stdClassObject->property = 'string1'; $stdClassObject->property2 = NULL; $stdClassObject->publicProperty2 = 42; $allProperties = \TYPO3\CMS\Extbase\Reflection\ObjectAccess::getGettableProperties($stdClassObject); $expectedProperties = array('property' => 'string1', 'property2' => NULL, 'publicProperty2' => 42); $this->assertEquals($expectedProperties, $allProperties, 'expectedProperties did not return the right values for the properties.'); }
/** * @return string */ public function render() { $nodes = array(); foreach ($this->childViewHelperNodes as $viewHelperNode) { $viewHelper = $viewHelperNode->getUninitializedViewHelper(); $arguments = $viewHelper->prepareArguments(); $givenArguments = $viewHelperNode->getArguments(); $viewHelperReflection = new \ReflectionClass($viewHelper); $viewHelperDescription = $viewHelperReflection->getDocComment(); $viewHelperDescription = htmlentities($viewHelperDescription); $viewHelperDescription = '[CLASS DOC]' . LF . $viewHelperDescription . LF; $renderMethodDescription = $viewHelperReflection->getMethod('render')->getDocComment(); $renderMethodDescription = htmlentities($renderMethodDescription); $renderMethodDescription = implode(LF, array_map('trim', explode(LF, $renderMethodDescription))); $renderMethodDescription = '[RENDER METHOD DOC]' . LF . $renderMethodDescription . LF; $argumentDefinitions = array(); foreach ($arguments as $argument) { $name = $argument->getName(); $argumentDefinitions[$name] = ObjectAccess::getGettableProperties($argument); } $sections = array($viewHelperDescription, DebuggerUtility::var_dump($argumentDefinitions, '[ARGUMENTS]', 4, TRUE, FALSE, TRUE), DebuggerUtility::var_dump($givenArguments, '[CURRENT ARGUMENTS]', 4, TRUE, FALSE, TRUE), $renderMethodDescription); array_push($nodes, implode(LF, $sections)); } if (0 < count($this->childObjectAccessorNodes)) { array_push($nodes, '[VARIABLE ACCESSORS]'); $templateVariables = $this->templateVariableContainer->getAll(); foreach ($this->childObjectAccessorNodes as $objectAccessorNode) { $path = $objectAccessorNode->getObjectPath(); $segments = explode('.', $path); try { $value = ObjectAccess::getProperty($templateVariables, array_shift($segments)); foreach ($segments as $segment) { $value = ObjectAccess::getProperty($value, $segment); } $type = gettype($value); } catch (PropertyNotAccessibleException $error) { $value = NULL; $type = 'UNDEFINED/INACCESSIBLE'; } $sections = array('Path: {' . $path . '}', 'Value type: ' . $type); if (TRUE === is_object($value)) { $sections[] = 'Accessible properties on {' . $path . '}:'; $gettable = ObjectAccess::getGettablePropertyNames($value); unset($gettable[0]); foreach ($gettable as $gettableProperty) { $sections[] = ' {' . $path . '.' . $gettableProperty . '} (' . gettype(ObjectAccess::getProperty($value, $gettableProperty)) . ')'; } } elseif (NULL !== $value) { $sections[] = DebuggerUtility::var_dump($value, 'Dump of variable "' . $path . '"', 4, TRUE, FALSE, TRUE); } array_push($nodes, implode(LF, $sections)); } } return '<pre>' . implode(LF . LF, $nodes) . '</pre>'; }
/** * Get value for multi fieldtypes (checkbox, radio) * * @param \In2code\Powermail\Domain\Model\Field $field * @param \In2code\Powermail\Domain\Model\Mail $mail To prefill in Edit Action * @param \int $cycle Cycle Number (1,2,3...) - if filled checkbox or radiobutton * @return string */ protected function getMultiValue(\In2code\Powermail\Domain\Model\Field $field, \In2code\Powermail\Domain\Model\Mail $mail = NULL, $cycle = 0) { $marker = $field->getMarker(); $uid = $field->getUid(); $selected = 0; $index = $cycle - 1; $options = $field->getModifiedSettings(); // edit view if ($mail !== NULL && $mail->getAnswers()) { foreach ($mail->getAnswers() as $answer) { if ($answer->getField() === $field) { $values = $answer->getValue(); foreach ((array) $values as $value) { if ($value === $options[$index]['value'] || $value === $options[$index]['label']) { $selected = 1; } } } } } // if GET/POST with marker (&tx_powermail_pi1[field][marker][index]=value) if (isset($this->piVars['field'][$marker]) && is_array($this->piVars['field'][$marker])) { foreach (array_keys($this->piVars['field'][$marker]) as $key) { if ($this->piVars['field'][$marker][$key] === $options[$index]['value'] || $this->piVars['field'][$marker][$key] === $options[$index]['label']) { $selected = 1; } } } elseif (isset($this->piVars['field'][$marker])) { if ($this->piVars['field'][$marker] == $options[$index]['value'] || $this->piVars['field'][$marker] == $options[$index]['label']) { $selected = 1; } } elseif (isset($this->piVars[$marker]) && is_array($this->piVars[$marker])) { foreach (array_keys($this->piVars[$marker]) as $key) { if ($this->piVars[$marker][$key] === $options[$index]['value'] || $this->piVars[$marker][$key] === $options[$index]['label']) { $selected = 1; } } } elseif (isset($this->piVars[$marker])) { if ($this->piVars[$marker] == $options[$index]['value'] || $this->piVars[$marker] == $options[$index]['label']) { $selected = 1; } } elseif (isset($this->piVars['field'][$uid])) { if (is_array($this->piVars['field'][$uid])) { foreach ($this->piVars['field'][$uid] as $key => $value) { $value = NULL; if ($this->piVars['field'][$uid][$key] == $options[$index]['value'] || $this->piVars['field'][$uid][$key] == $options[$index]['label']) { $selected = 1; } } } else { if ($this->piVars['field'][$uid] == $options[$index]['value'] || $this->piVars['field'][$uid] == $options[$index]['label']) { $selected = 1; } } } elseif (isset($this->piVars['uid' . $uid])) { if ($this->piVars['uid' . $uid] == $options[$index]['value'] || $this->piVars['uid' . $uid] == $options[$index]['label']) { $selected = 1; } } elseif ($field->getFeuserValue() && intval($GLOBALS['TSFE']->fe_user->user['uid']) !== 0) { // if fe_user is logged in if ($GLOBALS['TSFE']->fe_user->user[$field->getFeuserValue()] == $options[$index]['value'] || $GLOBALS['TSFE']->fe_user->user[$field->getFeuserValue()] == $options[$index]['label']) { $selected = 1; } } elseif ($options[$index]['selected']) { $selected = 1; } elseif (isset($this->settings['prefill.'][$marker]) || isset($this->settings['prefill.'][$marker . '.'])) { if (isset($this->settings['prefill.'][$marker . '.']) && is_array($this->settings['prefill.'][$marker . '.'])) { $data = \TYPO3\CMS\Extbase\Reflection\ObjectAccess::getGettableProperties($field); $this->cObj->start($data); if (isset($this->settings['prefill.'][$marker . '.']['0'])) { /** * plugin.tx_powermail.settings.setup.prefill.marker.0 = TEXT * plugin.tx_powermail.settings.setup.prefill.marker.0.value = red */ foreach (array_keys($this->settings['prefill.'][$marker . '.']) as $key) { if (stristr($key, '.')) { continue; } $prefill = $this->cObj->cObjGetSingle($this->settings['prefill.'][$marker . '.'][$key], $this->settings['prefill.'][$marker . '.'][$key . '.']); if ($prefill == $options[$index]['value'] || $prefill == $options[$index]['label']) { $selected = 1; } } } else { /** * plugin.tx_powermail.settings.setup.prefill.marker = TEXT * plugin.tx_powermail.settings.setup.prefill.marker.value = red */ $prefill = $this->cObj->cObjGetSingle($this->settings['prefill.'][$marker], $this->settings['prefill.'][$marker . '.']); if ($prefill == $options[$index]['value'] || $prefill == $options[$index]['label']) { $selected = 1; } } } else { /** * plugin.tx_powermail.settings.setup.prefill.marker = red */ if ($this->settings['prefill.'][$marker] == $options[$index]['value'] || $this->settings['prefill.'][$marker] == $options[$index]['label']) { $selected = 1; } } } return $selected; }
/** * Convert a single DomainObject instance first to an array, then pass * that array through recursive DomainObject detection. This will convert * any 1:1, 1:n, n:1 and m:n relations. * * @param DomainObjectInterface $domainObject * @param boolean $preventRecursion * @param mixed $recursionMarker * @return array */ protected function recursiveDomainObjectToArray(DomainObjectInterface $domainObject, $preventRecursion, $recursionMarker) { $hash = spl_object_hash($domainObject); if (TRUE === $preventRecursion && TRUE === in_array($hash, $this->encounteredClasses)) { return $recursionMarker; } $converted = ObjectAccess::getGettableProperties($domainObject); array_push($this->encounteredClasses, $hash); $converted = $this->recursiveArrayOfDomainObjectsToArray($converted, $preventRecursion, $recursionMarker); return $converted; }
/** * Renders an image including a Google Map for a date * * @param float $latitude Latitude * @param float $longitude Longitude * @param string $client Client ("facebook", "twitter") * @return string Image URL */ public function render($latitude, $longitude, $client = 'facebook') { switch (strtolower($client)) { case 'facebook': $size = '470x492'; break; case 'twitter': $size = '500x340'; break; default: return ''; break; } $data = 'typo3temp' . DIRECTORY_SEPARATOR . 'coderdojo-map-' . md5($latitude . $longitude . $size) . '.jpg'; $googleMap = "https://maps.googleapis.com/maps/api/staticmap?center={$latitude},{$longitude}&size={$size}&zoom=14&markers=color:red|{$latitude},{$longitude}"; if (!@file_exists(PATH_site . $data)) { copy($googleMap, PATH_site . $data); } $currentValue = null; if (is_object($data)) { $data = \TYPO3\CMS\Extbase\Reflection\ObjectAccess::getGettableProperties($data); } elseif (is_string($data) || is_numeric($data)) { $currentValue = (string) $data; $data = array($data); } /** @var \TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer $contentObject */ $contentObject = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class); $contentObject->start($data, ''); if ($currentValue !== null) { $contentObject->setCurrentVal($currentValue); } $pathSegments = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode('.', 'lib.coderdojo.' . $client); $lastSegment = array_pop($pathSegments); $setup = $this->typoScriptSetup; foreach ($pathSegments as $segment) { if (!array_key_exists($segment . '.', $setup)) { throw new \TYPO3\CMS\Fluid\Core\ViewHelper\Exception('TypoScript object path "' . htmlspecialchars('lib.coderdojo.' . $client) . '" does not exist', 1253191023); } $setup = $setup[$segment . '.']; } return $contentObject->cObjGetSingle($setup[$lastSegment], $setup[$lastSegment . '.']); }
/** * Convert model to array * @return array Converted model */ public function toArray() { return \TYPO3\CMS\Extbase\Reflection\ObjectAccess::getGettableProperties($this); }
/** * action create * * @param Reservation $newReservation * @return void */ public function createAction(Reservation $newReservation) { if (!is_null($newReservation->getUid()) || $this->session instanceof SessionInterface && $this->session->has(self::SESSION_IDENTIFIER_RESERVATION)) { $this->denyAccess(); return; } if ($contact = $newReservation->getContact()) { $contact->setReservation($newReservation); } $newReservation->setStatus(Reservation::STATUS_DRAFT); if ($newReservation->getContactIsParticipant() && is_object($contact)) { $participant = new Person(); foreach (ObjectAccess::getGettableProperties($contact) as $propertyName => $propertyValue) { if (ObjectAccess::isPropertySettable($participant, $propertyName)) { ObjectAccess::setProperty($participant, $propertyName, $propertyValue); } } $participant->setType(Person::PERSON_TYPE_PARTICIPANT); $newReservation->addParticipant($participant); $newReservation->getLesson()->addParticipant($participant); } $this->addFlashMessage($this->translate('message.reservation.create.success')); $this->reservationRepository->add($newReservation); $this->persistenceManager->persistAll(); $this->session->set(self::SESSION_IDENTIFIER_RESERVATION, $newReservation->getUid()); $this->redirect('edit', null, null, ['reservation' => $newReservation]); }
/** * Get from TypoScript content object like * * # direct value * plugin.tx_powermail.settings.setup.prefill.marker = TEXT * plugin.tx_powermail.settings.setup.prefill.marker.value = red * * # multiple value * plugin.tx_powermail.settings.setup.prefill.marker.0 = TEXT * plugin.tx_powermail.settings.setup.prefill.marker.0.value = red * * @return bool */ protected function getFromTypoScriptContentObject() { $selected = false; if (isset($this->settings['prefill.'][$this->getMarker() . '.']) && is_array($this->settings['prefill.'][$this->getMarker() . '.'])) { $this->contentObjectRenderer->start(ObjectAccess::getGettableProperties($this->getField())); // Multivalue if (isset($this->settings['prefill.'][$this->getMarker() . '.']['0'])) { foreach (array_keys($this->settings['prefill.'][$this->getMarker() . '.']) as $key) { if (stristr($key, '.')) { continue; } $prefill = $this->contentObjectRenderer->cObjGetSingle($this->settings['prefill.'][$this->getMarker() . '.'][$key], $this->settings['prefill.'][$this->getMarker() . '.'][$key . '.']); if ($prefill === $this->options[$this->index]['value'] || $prefill === $this->options[$this->index]['label']) { $selected = true; } } } else { // Single value $prefill = $this->contentObjectRenderer->cObjGetSingle($this->settings['prefill.'][$this->getMarker()], $this->settings['prefill.'][$this->getMarker() . '.']); if ($prefill === $this->options[$this->index]['value'] || $prefill === $this->options[$this->index]['label']) { $selected = true; } } } return $selected; }