當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ArrayUtility::getValueByPath方法代碼示例

本文整理匯總了PHP中TYPO3\CMS\Core\Utility\ArrayUtility::getValueByPath方法的典型用法代碼示例。如果您正苦於以下問題:PHP ArrayUtility::getValueByPath方法的具體用法?PHP ArrayUtility::getValueByPath怎麽用?PHP ArrayUtility::getValueByPath使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在TYPO3\CMS\Core\Utility\ArrayUtility的用法示例。


在下文中一共展示了ArrayUtility::getValueByPath方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: configure

 /**
  * Configures the pages.abstract RTE
  *
  * @param array $configuration Extension configuration
  *
  * @return void
  */
 public static function configure(array $configuration)
 {
     try {
         self::$configuration = ArrayUtility::getValueByPath($configuration, 'pages./abstract./rte.');
         self::disableGlobally();
         self::setVisibleButtons();
         self::setHiddenButtons();
     } catch (\Exception $e) {
     }
 }
開發者ID:svenhartmann,項目名稱:vantomas,代碼行數:17,代碼來源:PageAbstractRte.php

示例2: getConfigurationFromPath

 /**
  * Returns the TypoScript configuration value at a the given path.
  * Example: config.tx_myext.some_conf
  *
  * @param    string        $path      The path to the configuration value.
  * @param    int|null|bool $pageUid   The uid of the page you want the TypoScript configuration from. If "null" is given, only the static configuration is returned.
  * @param    string        $delimiter The delimiter for the path. Default is ".".
  * @return    mixed|null
  */
 public static function getConfigurationFromPath($path, $pageUid = null, $delimiter = '.')
 {
     $result = null;
     $cacheIdentifier = md5($path . (string) $pageUid);
     $cacheInstance = CacheManager::getCacheInstance(CacheManager::CACHE_MAIN);
     if ($cacheInstance) {
         if ($cacheInstance->has($cacheIdentifier)) {
             $result = $cacheInstance->get($cacheIdentifier);
         } elseif (ArrayUtility::isValidPath(self::getTypoScriptConfiguration($pageUid), $path, $delimiter)) {
             $result = ArrayUtility::getValueByPath(self::getTypoScriptConfiguration($pageUid), $path, $delimiter);
             $cacheInstance->set($cacheIdentifier, $result);
         }
     }
     return $result;
 }
開發者ID:romaincanon,項目名稱:TYPO3-Site-Factory,代碼行數:24,代碼來源:TypoScriptUtility.php

示例3: parseOption

 /**
  * Read the option called $optionName from $this->options, and parse {...}
  * as object accessors.
  *
  * Then translate the value.
  *
  * If $optionName was not found, the corresponding default option is returned (from $this->defaultOptions)
  *
  * @param string $optionName
  * @return string|array|null
  * @api
  */
 protected function parseOption(string $optionName)
 {
     if ($optionName === 'translation') {
         return null;
     }
     $optionValue = ArrayUtility::getValueByPath($this->options, $optionName);
     $defaultValue = ArrayUtility::getValueByPath($this->defaultOptions, $optionName);
     if ($optionValue === null && $defaultValue !== null) {
         $optionValue = $defaultValue;
     }
     if ($optionValue === null) {
         return null;
     }
     if (is_array($optionValue)) {
         return $optionValue;
     }
     $formRuntime = $this->finisherContext->getFormRuntime();
     $optionToCompare = $optionValue;
     // You can encapsulate a option value with {}.
     // This enables you to access every getable property from the
     // TYPO3\CMS\Form\Domain\Runtime.
     //
     // For example: {formState.formValues.<elemenIdentifier>}
     // This is equal to "$formRuntime->getFormState()->getFormValues()[<elemenIdentifier>]"
     $optionValue = preg_replace_callback('/{([^}]+)}/', function ($match) use($formRuntime) {
         return ObjectAccess::getPropertyPath($formRuntime, $match[1]);
     }, $optionValue);
     if ($optionToCompare === $optionValue) {
         // This is just a shortcut for a {formState.formValues.<elementIdentifier>} notation.
         // If one of the finisher option values is equal
         // to a identifier from the form definition then
         // the value of the submitted form element is used
         // insteed.
         // Lets say you have a textfield in your form with the
         // identifier "Text1". If you put "Text1"
         // in the email finisher option "subject" then the submited value
         // from the "Text1" element is used as the email subject.
         $formValues = $this->finisherContext->getFormValues();
         if (!is_bool($optionValue) && array_key_exists($optionValue, $formValues)) {
             $optionValue = $formRuntime[$optionValue];
         }
     }
     if (isset($this->options['translation']['translationFile'])) {
         $optionValue = TranslationService::getInstance()->translateFinisherOption($formRuntime, $this->finisherIdentifier, $optionName, $optionValue, $this->options['translation']);
     }
     if (empty($optionValue)) {
         if ($defaultValue !== null) {
             $optionValue = $defaultValue;
         }
     }
     return $optionValue;
 }
開發者ID:,項目名稱:,代碼行數:64,代碼來源:

示例4: getConfigurationValueByPath

 /**
  * Get a value from configuration, this is default configuration
  * merged with local configuration
  *
  * @param string $path Path to search for
  * @return mixed
  */
 public function getConfigurationValueByPath($path)
 {
     return Utility\ArrayUtility::getValueByPath(Utility\GeneralUtility::array_merge_recursive_overrule($this->getDefaultConfiguration(), $this->getLocalConfiguration()), $path);
 }
開發者ID:nicksergio,項目名稱:TYPO3v4-Core,代碼行數:11,代碼來源:ConfigurationManager.php

示例5: getProcessSettings

 /**
  * Get the value within the settings of the duplication process, at the
  * given path.
  * If $path begins with "data:", the function will search for the
  * duplication data at the given index (string after "data:"), and return
  * the value, if found.
  *
  * @param	string	$path		The path within the settings, if none given, the full settings will be returned.
  * @param	string	$delimiter	The delimiter for path, default ".".
  * @return	mixed	The settings of the process at the given path, or the duplication data value (see function documentation).
  */
 public function getProcessSettings($path = null, $delimiter = '.')
 {
     if ($path) {
         $setting = ArrayUtility::isValidPath($this->settings, $path, $delimiter) ? ArrayUtility::getValueByPath($this->settings, $path, $delimiter) : null;
         if ($setting) {
             if (strpos($setting, 'data:') !== false) {
                 $settingDataKey = substr($setting, 5);
                 if ($this->getDuplicationData($settingDataKey)) {
                     $setting = $this->getDuplicationData($settingDataKey);
                 }
             }
         }
         return $setting;
     }
     return $this->settings;
 }
開發者ID:AgenceStratis,項目名稱:TYPO3-Site-Factory,代碼行數:27,代碼來源:AbstractDuplicationProcess.php

示例6: getConfigurationValueByPath

 /**
  * Get a value from configuration, this is default configuration
  * merged with local configuration
  *
  * @param string $path Path to search for
  * @return mixed
  */
 public function getConfigurationValueByPath($path)
 {
     $defaultConfiguration = $this->getDefaultConfiguration();
     Utility\ArrayUtility::mergeRecursiveWithOverrule($defaultConfiguration, $this->getLocalConfiguration());
     return Utility\ArrayUtility::getValueByPath($defaultConfiguration, $path);
 }
開發者ID:Mr-Robota,項目名稱:TYPO3.CMS,代碼行數:13,代碼來源:ConfigurationManager.php

示例7: getSettings

 /**
  * @param    string $path      The path within the settings, if none given, the full settings will be returned.
  * @param    string $delimiter The delimiter for path, default ".".
  * @return mixed    The settings of the field.
  */
 public function getSettings($path = null, $delimiter = '.')
 {
     if ($path) {
         $setting = \TYPO3\CMS\Core\Utility\ArrayUtility::isValidPath($this->settings, $path, $delimiter) ? \TYPO3\CMS\Core\Utility\ArrayUtility::getValueByPath($this->settings, $path, $delimiter) : null;
         return $setting;
     }
     return $this->settings;
 }
開發者ID:romaincanon,項目名稱:TYPO3-Site-Factory,代碼行數:13,代碼來源:AbstractField.php

示例8: mapAndValidatePage

 /**
  * @param Page $page
  * @return Result
  * @throws PropertyMappingException
  */
 protected function mapAndValidatePage(Page $page) : Result
 {
     $result = $this->objectManager->get(Result::class);
     $requestArguments = $this->request->getArguments();
     $propertyPathsForWhichPropertyMappingShouldHappen = [];
     $registerPropertyPaths = function ($propertyPath) use(&$propertyPathsForWhichPropertyMappingShouldHappen) {
         $propertyPathParts = explode('.', $propertyPath);
         $accumulatedPropertyPathParts = [];
         foreach ($propertyPathParts as $propertyPathPart) {
             $accumulatedPropertyPathParts[] = $propertyPathPart;
             $temporaryPropertyPath = implode('.', $accumulatedPropertyPathParts);
             $propertyPathsForWhichPropertyMappingShouldHappen[$temporaryPropertyPath] = $temporaryPropertyPath;
         }
     };
     foreach ($page->getElementsRecursively() as $element) {
         $value = ArrayUtility::getValueByPath($requestArguments, $element->getIdentifier());
         $element->onSubmit($this, $value, $requestArguments);
         $this->formState->setFormValue($element->getIdentifier(), $value);
         $registerPropertyPaths($element->getIdentifier());
     }
     // The more parts the path has, the more early it is processed
     usort($propertyPathsForWhichPropertyMappingShouldHappen, function ($a, $b) {
         return substr_count($b, '.') - substr_count($a, '.');
     });
     $processingRules = $this->formDefinition->getProcessingRules();
     foreach ($propertyPathsForWhichPropertyMappingShouldHappen as $propertyPath) {
         if (isset($processingRules[$propertyPath])) {
             $processingRule = $processingRules[$propertyPath];
             $value = $this->formState->getFormValue($propertyPath);
             try {
                 $value = $processingRule->process($value);
             } catch (PropertyException $exception) {
                 throw new PropertyMappingException('Failed to process FormValue at "' . $propertyPath . '" from "' . gettype($value) . '" to "' . $processingRule->getDataType() . '"', 1480024933, $exception);
             }
             $result->forProperty($propertyPath)->merge($processingRule->getProcessingMessages());
             $this->formState->setFormValue($propertyPath, $value);
         }
     }
     return $result;
 }
開發者ID:,項目名稱:,代碼行數:45,代碼來源:

示例9: getFormValue

 /**
  * @param string $propertyPath
  * @return mixed
  */
 public function getFormValue(string $propertyPath)
 {
     return ArrayUtility::getValueByPath($this->formValues, $propertyPath);
 }
開發者ID:,項目名稱:,代碼行數:8,代碼來源:

示例10: callTypoScriptLibrary

 /**
  * Calls a defined TypoScript library.
  *
  * @param	array	$arguments	Array containing the request arguments.
  * @param	int		$id			The page uid.
  * @return	string	The result of the TypoScript library.
  * @throws \Exception
  */
 private function callTypoScriptLibrary($arguments, $id)
 {
     $pageConfiguration = self::getPageConfiguration($id);
     if (ArrayUtility::isValidPath($pageConfiguration, $arguments['typoScriptLib'], '.')) {
         $typoScriptLib = ArrayUtility::getValueByPath($pageConfiguration, $arguments['typoScriptLib'], '.');
         if (!array_key_exists('_typoScriptNodeValue', $typoScriptLib)) {
             throw new \Exception('The TypoScript libraty "' . $arguments['typoScriptLib'] . '" does not have a Content Object type.', 1429113764);
         }
         $result = $this->callContentObject($typoScriptLib, $arguments['arguments']);
         return $result;
     } else {
         throw new \Exception('TypoScript library "' . $arguments['typoScriptLib'] . '" was not found.', 1429113004);
     }
 }
開發者ID:AgenceStratis,項目名稱:TYPO3-Site-Factory,代碼行數:22,代碼來源:AjaxDispatcherUtility.php

示例11: getTemplateConstantsUidAssociationString

 /**
  * Returns a string containing all the constants configuration for the
  * pages.
  *
  * @param	int		$pageUid				The page uid.
  * @param	array	$pageUidAssociation		Association of uid for the given page.
  * @return	string
  */
 private static function getTemplateConstantsUidAssociationString($pageUid, array $pageUidAssociation)
 {
     $constantsString = '';
     $pagesPaths = TypoScriptUtility::getExtensionConfigurationFromPath('constantsPaths.pagesPaths');
     if (!is_array($pagesPaths)) {
     } else {
         $constants = TypoScriptUtility::getTypoScriptConstants($pageUid);
         foreach ($pagesPaths as $path) {
             if (ArrayUtility::isValidPath($constants, $path, '.')) {
                 $pagesValues = ArrayUtility::getValueByPath($constants, $path, '.');
                 if (is_array($pagesValues)) {
                     foreach ($pagesValues as $pageName => $pageValue) {
                         if (array_key_exists($pageValue, $pageUidAssociation)) {
                             $constantsString .= $path . '.' . $pageName . ' = ' . $pageUidAssociation[$pageValue] . CRLF;
                         }
                     }
                 }
             }
         }
     }
     return $constantsString;
 }
開發者ID:AgenceStratis,項目名稱:TYPO3-Site-Factory,代碼行數:30,代碼來源:ConstantManagerUtility.php

示例12: getConfigurationValueByPath

 /**
  * Get a value from configuration, this is default configuration
  * merged with local configuration
  *
  * @param string $path Path to search for
  * @return mixed
  */
 public static function getConfigurationValueByPath($path)
 {
     return \TYPO3\CMS\Core\Utility\ArrayUtility::getValueByPath(\TYPO3\CMS\Core\Utility\GeneralUtility::array_merge_recursive_overrule(static::getDefaultConfiguration(), static::getLocalConfiguration()), $path);
 }
開發者ID:noxludo,項目名稱:TYPO3v4-Core,代碼行數:11,代碼來源:ConfigurationManager.php

示例13: translateFormElementValue

 /**
  * @param RootRenderableInterface $element
  * @param string $property
  * @param FormRuntime $formRuntime
  * @return string|array
  * @throws \InvalidArgumentException
  * @internal
  */
 public function translateFormElementValue(RootRenderableInterface $element, string $property, FormRuntime $formRuntime)
 {
     if (empty($property)) {
         throw new \InvalidArgumentException('The argument "property" is empty', 1476216007);
     }
     $propertyType = 'properties';
     $renderingOptions = $element->getRenderingOptions();
     if ($property === 'label') {
         $defaultValue = $element->getLabel();
     } else {
         if ($element instanceof FormElementInterface) {
             $defaultValue = ArrayUtility::getValueByPath($element->getProperties(), $property);
         } else {
             $propertyType = 'renderingOptions';
             $defaultValue = ArrayUtility::getValueByPath($renderingOptions, $property);
         }
     }
     if (isset($renderingOptions['translation']['translatePropertyValueIfEmpty'])) {
         $translatePropertyValueIfEmpty = $renderingOptions['translation']['translatePropertyValueIfEmpty'];
     } else {
         $translatePropertyValueIfEmpty = true;
     }
     if (empty($defaultValue) && !$translatePropertyValueIfEmpty) {
         return $defaultValue;
     }
     $defaultValue = empty($defaultValue) ? '' : $defaultValue;
     $translationFile = $renderingOptions['translation']['translationFile'];
     $language = null;
     if (isset($renderingOptions['translation']['language'])) {
         $language = $renderingOptions['translation']['language'];
     }
     $translationKeyChain = [];
     if ($property === 'options' && is_array($defaultValue)) {
         foreach ($defaultValue as $optionValue => &$optionLabel) {
             $translationKeyChain = [sprintf('%s:%s.element.%s.%s.%s.%s', $translationFile, $formRuntime->getIdentifier(), $element->getIdentifier(), $propertyType, $property, $optionValue), sprintf('%s:element.%s.%s.%s.%s', $translationFile, $element->getIdentifier(), $propertyType, $property, $optionValue)];
             $translatedValue = $this->processTranslationChain($translationKeyChain, $language);
             $optionLabel = empty($translatedValue) ? $optionLabel : $translatedValue;
         }
         $translatedValue = $defaultValue;
     } else {
         $translationKeyChain = [sprintf('%s:%s.element.%s.%s.%s', $translationFile, $formRuntime->getIdentifier(), $element->getIdentifier(), $propertyType, $property), sprintf('%s:element.%s.%s.%s', $translationFile, $element->getIdentifier(), $propertyType, $property), sprintf('%s:element.%s.%s.%s', $translationFile, $element->getType(), $propertyType, $property)];
         $translatedValue = $this->processTranslationChain($translationKeyChain, $language);
         $translatedValue = empty($translatedValue) ? $defaultValue : $translatedValue;
     }
     return $translatedValue;
 }
開發者ID:,項目名稱:,代碼行數:54,代碼來源:

示例14: get

 /**
  * Get value by path.
  * @param  string $path    Path to value.
  * @param  mixed $default  Return value if none could by found.
  * @return mixed
  */
 public function get($path, $default = NULL)
 {
     try {
         $value = \TYPO3\CMS\Core\Utility\ArrayUtility::getValueByPath($this->array, $path, $this->delimiter);
     } catch (\RuntimeException $exception) {
         $value = $default;
     }
     return $value;
 }
開發者ID:r3h6,項目名稱:TYPO3.EXT.frp_example,代碼行數:15,代碼來源:Setup.php

示例15: getValueByPathHelper

 /**
  * Helper to return a specified path.
  *
  * @param array &$array The array to traverse as a reference
  * @param array|string $path The path to follow. Either a simple array of keys or a string in the format 'foo.bar.baz'
  * @return mixed The value found, NULL if the path didn't exist
  */
 protected static function getValueByPathHelper(array $array, $path)
 {
     try {
         return ArrayUtility::getValueByPath($array, $path, '.');
     } catch (\RuntimeException $e) {
         return null;
     }
 }
開發者ID:,項目名稱:,代碼行數:15,代碼來源:


注:本文中的TYPO3\CMS\Core\Utility\ArrayUtility::getValueByPath方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。