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


PHP XMLElement::convertFromXMLString方法代码示例

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


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

示例1: appendAssociatedEntries

 /**
  * Append associated entries to the XML output
  */
 public function appendAssociatedEntries($context)
 {
     $datasource = $context['datasource'];
     $section_id = $datasource->getSource();
     $xml = $context['xml'];
     $parameters = $context['param_pool'];
     if (!empty($datasource->dsParamINCLUDEDASSOCIATIONS) && !$datasource->addedAssociationOutput) {
         //only convert xml to object if not an object and has associations
         $xml = is_object($xml) ? $xml : XMLElement::convertFromXMLString($datasource->dsParamROOTELEMENT, $xml);
         if (!$datasource->addedAssociationOutput) {
             $datasource->addedAssociationOutput = false;
         }
         foreach ($datasource->dsParamINCLUDEDASSOCIATIONS as $name => $settings) {
             $transcriptions = array();
             $entry_ids = null;
             $parameter_name = 'ds-' . $datasource->dsParamROOTELEMENT . '.' . $name;
             if (!empty($parameters[$parameter_name])) {
                 if (!is_array($parameters[$parameter_name])) {
                     $entry_ids = array($parameters[$parameter_name]);
                 } else {
                     $entry_ids = array_unique($parameters[$parameter_name]);
                 }
             }
             if (!empty($entry_ids)) {
                 if (!is_numeric($entry_ids[0])) {
                     $this->fetchEntryIdsByValues($entry_ids, $transcriptions, $settings['field_id']);
                 }
                 // Append associated entries
                 $associated_xml = $this->fetchAssociatedEntries($datasource, $settings, $section_id, $entry_ids);
                 $associated_items = $this->groupAssociatedEntries($associated_xml);
                 $this->findAssociatedEntries($xml, $associated_items, $name, $transcriptions);
                 //set added association output to true
                 $datasource->addedAssociationOutput = true;
                 // Clean up parameter pool
                 $this->unsetOutputParameters($context);
             }
         }
         if ($datasource->addedAssociationOutput) {
             /**
              * Allows extensions to do other processing after the association output data is added to the XML, and parameters cleaned
              *
              * @since Association Output 1.2.0
              * @delegate AssociationOutputPostExecute
              * @param string $context
              * '/frontend/'
              * @param DataSource $datasource
              *  The Datasource object
              * @param XMLElement $xml
              *  The XML output of the data source.
              * @param array $param_pool
              *  The existing param pool including output parameters of any previous data sources
              */
             Symphony::ExtensionManager()->notifyMembers('AssociationOutputPostExecute', '/frontend/', array('datasource' => &$datasource, 'xml' => &$xml, 'param_pool' => &$parameters));
         }
     }
 }
开发者ID:rc1,项目名称:WebAppsWithCmsStartHere,代码行数:59,代码来源:extension.driver.php


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