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


PHP DataSource::loadFromHandle方法代码示例

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


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

示例1: __viewInfo

 public function __viewInfo()
 {
     $datasource = DataSource::loadFromHandle($this->_context[1]);
     $about = $datasource->about();
     $this->setTitle(__('%1$s – %2$s – %3$s', array(__('Symphony'), __('Data Source'), $about->name)));
     $this->appendSubheading($about->name);
     $this->Form->setAttribute('id', 'controller');
     $link = $about->author->name;
     if (isset($about->author->website)) {
         $link = Widget::Anchor($about->author->name, General::validateURL($about->author->website));
     } elseif (isset($about->author->email)) {
         $link = Widget::Anchor($about->author->name, 'mailto:' . $about->author->email);
     }
     foreach ($about as $key => $value) {
         $fieldset = NULL;
         switch ($key) {
             case 'user':
                 $fieldset = $this->createElement('fieldset');
                 $fieldset->appendChild($this->createElement('legend', 'User'));
                 $fieldset->appendChild($this->createElement('p', $link));
                 break;
             case 'version':
                 $fieldset = $this->createElement('fieldset');
                 $fieldset->appendChild($this->createElement('legend', 'Version'));
                 $fieldset->appendChild($this->createElement('p', $value . ', released on ' . DateTimeObj::get(__SYM_DATE_FORMAT__, strtotime($about->{'release-date'}))));
                 break;
             case 'description':
                 $fieldset = $this->createElement('fieldset');
                 $fieldset->appendChild($this->createElement('legend', 'Description'));
                 $fieldset->appendChild(is_object($about->description) ? $about->description : $this->createElement('p', $about->description));
             case 'example':
                 if (is_callable(array($datasource, 'example'))) {
                     $fieldset = $this->createElement('fieldset');
                     $fieldset->appendChild($this->createElement('legend', 'Example XML'));
                     $example = $datasource->example();
                     if (is_object($example)) {
                         $fieldset->appendChild($example);
                     } else {
                         $p = $this->createElement('p');
                         $p->appendChild($this->createElement('pre', '<code>' . str_replace('<', '&lt;', $example) . '</code>'));
                         $fieldset->appendChild($p);
                     }
                 }
                 break;
         }
         if ($fieldset) {
             $fieldset->setAttribute('class', 'settings');
             $this->Form->appendChild($fieldset);
         }
     }
     /*
     $dl->appendChild(new XMLElement('dt', __('URL Parameters')));
     if(!is_array($about['recognised-url-param']) || empty($about['recognised-url-param'])){
     	$dl->appendChild(new XMLElement('dd', '<code>'.__('None').'</code>'));
     }
     else{
     	$dd = new XMLElement('dd');
     	$ul = new XMLElement('ul');
     
     	foreach($about['recognised-url-param'] as $f) $ul->appendChild(new XMLElement('li', '<code>' . $f . '</code>'));
     
     	$dd->appendChild($ul);
     	$dl->appendChild($dd);
     }
     $fieldset->appendChild($dl);
     */
 }
开发者ID:brendo,项目名称:symphony-3,代码行数:67,代码来源:content.blueprintsdatasources.php


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