当前位置: 首页>>代码示例>>PHP>>正文


PHP ObjectAccess::getGettableProperties方法代码示例

本文整理汇总了PHP中TYPO3\CMS\Extbase\Reflection\ObjectAccess::getGettableProperties方法的典型用法代码示例。如果您正苦于以下问题:PHP ObjectAccess::getGettableProperties方法的具体用法?PHP ObjectAccess::getGettableProperties怎么用?PHP ObjectAccess::getGettableProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TYPO3\CMS\Extbase\Reflection\ObjectAccess的用法示例。


在下文中一共展示了ObjectAccess::getGettableProperties方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getStructure

 /**
  * @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;
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:31,代码来源:BlogController.php

示例2: render

 /**
  * @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>';
 }
开发者ID:chrmue01,项目名称:typo3-starter-kit,代码行数:28,代码来源:DebugViewHelper.php

示例3: extend

 /**
  * 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;
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:15,代码来源:ControllerContext.php

示例4: createDependingRegistrations

 /**
  * 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);
     }
 }
开发者ID:phathoang,项目名称:sf_event_mgt,代码行数:24,代码来源:RegistrationService.php

示例5: toArray

 /**
  * 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;
 }
开发者ID:dextar1,项目名称:t3extblog,代码行数:24,代码来源:AbstractEntity.php

示例6: render

 /**
  * 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;
 }
开发者ID:blypo,项目名称:blypo,代码行数:52,代码来源:CObject.php

示例7: render

 /**
  * 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;
     }
 }
开发者ID:extcode,项目名称:cart,代码行数:30,代码来源:MapModelPropertiesToTableColumnsViewHelper.php

示例8: getFromTypoScriptContentObject

 /**
  * 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;
 }
开发者ID:bernhardberger,项目名称:powermail,代码行数:34,代码来源:PrefillFieldViewHelper.php

示例9: render

 /**
  * 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;
 }
开发者ID:rickymathew,项目名称:TYPO3.CMS,代码行数:48,代码来源:CObjectViewHelper.php

示例10: getGettablePropertiesReturnsPropertiesOfStdClass

 /**
  * @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.');
 }
开发者ID:plan2net,项目名称:TYPO3.CMS,代码行数:13,代码来源:ObjectAccessTest.php

示例11: render

 /**
  * @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>';
 }
开发者ID:smichaelsen,项目名称:vhs,代码行数:58,代码来源:DebugViewHelper.php

示例12: getMultiValue

 /**
  * 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;
                 }
//.........这里部分代码省略.........
开发者ID:advOpk,项目名称:pwm,代码行数:101,代码来源:PrefillFieldViewHelper.php

示例13: recursiveDomainObjectToArray

 /**
  * 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;
 }
开发者ID:chrmue01,项目名称:typo3-starter-kit,代码行数:21,代码来源:EncodeViewHelper.php

示例14: render

 /**
  * 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 . '.']);
 }
开发者ID:jkphl,项目名称:coderdojo-nbg.org,代码行数:50,代码来源:DateMapViewHelper.php

示例15: toArray

 /**
  * Convert model to array
  * @return array  Converted model
  */
 public function toArray()
 {
     return \TYPO3\CMS\Extbase\Reflection\ObjectAccess::getGettableProperties($this);
 }
开发者ID:lokamaya,项目名称:html5mediaelements,代码行数:8,代码来源:Media.php


注:本文中的TYPO3\CMS\Extbase\Reflection\ObjectAccess::getGettableProperties方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。