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


PHP Cabinet::read方法代码示例

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


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

示例1: Cabinet

 function insert_cabinet_to_drupal($cabinet_id)
 {
     // set HTTP_HOST or drupal will refuse to bootstrap
     $_SERVER['HTTP_HOST'] = 'zl-apps';
     $_SERVER['REMOTE_ADDR'] = '127.0.0.1';
     include_once DRUPAL_ROOT . '/includes/bootstrap.inc';
     drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
     $cabinet = new Cabinet();
     $cabinet_detail = $cabinet->read(null, $cabinet_id);
     $cabinet_nid = null;
     $query = new EntityFieldQuery();
     $entities = $query->entityCondition('entity_type', 'node')->entityCondition('bundle', 'cabinet')->propertyCondition('status', 1)->fieldCondition('field_cabinet_id', 'value', $cabinet_detail['Cabinet']['id'], '=')->execute();
     if (!empty($entities)) {
         foreach ($entities['node'] as $nid => $value) {
             $cabinet_nid = $nid;
             break;
             // no need to loop more even if there is multiple (it is supposed to be unique
         }
     }
     $node = null;
     if (is_null($cabinet_nid)) {
         $node = new stdClass();
         $node->language = LANGUAGE_NONE;
     } else {
         $node = node_load($cabinet_nid);
     }
     $node->type = 'cabinet';
     node_object_prepare($node);
     $node->title = $cabinet_detail['Cabinet']['name'];
     $node->field_cabinet_id[$node->language][0]['value'] = $cabinet_detail['Cabinet']['id'];
     $node->field_product_type_id[$node->language][0]['value'] = $cabinet_detail['Cabinet']['product_type'];
     $node->sell_price = 0;
     $node->model = $cabinet_detail['Cabinet']['name'];
     $node->shippable = 1;
     $path = 'cabinet/' . $node->title;
     $node->path = array('alias' => $path);
     node_save($node);
 }
开发者ID:khaled-saiful-islam,项目名称:zen_v1.0,代码行数:38,代码来源:Cabinet.php


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