• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP entity_label函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中entity_label函数的典型用法代码示例。如果您正苦于以下问题:PHP entity_label函数的具体用法?PHP entity_label怎么用?PHP entity_label使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: getLabel

 /**
  * Overrides EntityReferenceHandler::getLabel().
  */
 public function getLabel($entity) {
   $target_type = $this->field['settings']['target_type'];
   $field = $entity->{OG_AUDIENCE_FIELD};
   $gid = $field[LANGUAGE_NONE][0]['target_id'];
   $group = entity_load_single('node', $gid);
   return entity_label($target_type, $entity).' ('.entity_label('node', $group).')';
 }
开发者ID:humanitarianresponse,项目名称:site,代码行数:10,代码来源:OgHRBundlesSelectionHandler.class.php


示例2: mergeEntityAsSynonym

 public function mergeEntityAsSynonym($items, $field, $instance, $synonym_entity, $synonym_entity_type)
 {
     // Let's say we keep the synonyms as strings and under the 'foo' column, to
     // keep it consistent with the extractSynonyms() method.
     $label = entity_label($synonym_entity_type, $synonym_entity);
     return array(array('foo' => $label));
 }
开发者ID:agroknow,项目名称:agreri,代码行数:7,代码来源:synonyms.api.php


示例3: getTitles

 /**
  * {inheritdoc}
  */
 protected function getTitles($idList)
 {
     $ret = [];
     foreach ($this->entityManager->getStorage('node')->load($idList) as $node) {
         $ret[$node->nid] = entity_label('node', $node);
     }
     return $ret;
 }
开发者ID:makinacorpus,项目名称:drupal-apubsub,代码行数:11,代码来源:NodeUpdated.php


示例4: viewAction

 /**
  * @Route("/{entity_type}/{entity}", name="entity_view", defaults={"view_mode" = "full", "langcode" = null, "page" = null})
  * @Method("GET")
  * @ParamConverter("entity", converter="drupal.entity")
  * @Template
  */
 public function viewAction(Request $request, $entity_type, $entity)
 {
     $view_mode = $request->get('view_mode');
     $langcode = $request->get('langcode');
     $page = $request->get('page');
     list($id, $vid, $bundle) = entity_extract_ids($entity_type, $entity);
     $entities = entity_view($entity_type, array($id => $entity), $view_mode, $langcode, $page);
     return array('label' => entity_label($entity_type, $entity), 'uri' => entity_uri($entity_type, $entity), 'entity_type' => $entity_type, 'id' => $id, 'vid' => $vid, 'bundle' => $bundle, 'entity' => $entity, 'content' => reset($entities[$entity_type]));
 }
开发者ID:bangpound,项目名称:drupal-bundle,代码行数:15,代码来源:EntityController.php


示例5: genresProcess

 public function genresProcess($tids)
 {
     $genres = taxonomy_term_load_multiple($tids);
     if (empty($genres)) {
         return NULL;
     }
     $element = [];
     foreach ($genres as $genre) {
         $path = entity_uri('taxonomy_term', $genre);
         $element[] = array('name' => entity_label('taxonomy_term', $genre), 'path' => url($path['path'], $path['options']));
     }
     return $element;
 }
开发者ID:adam-s,项目名称:954live,代码行数:13,代码来源:LivesearchArtists__1_0.php


示例6: exportContextResults

 /**
  * Sends the context messages back to Drupal's messaging system using
  * drupal_set_message.
  *
  * Please note that this is meant to be called before using drupal_goto()
  * to redirect the user to a result page.
  *
  * @param array $results The context from the batch operation.
  */
 public static function exportContextResults(array $results)
 {
     foreach ($results as $result) {
         if ($result['entity_id'] && $result['entity_type']) {
             $message = ':label [<strong>:type</strong> <code>:id</code>] !message';
             $arguments = array(':label' => entity_label($result['entity_type'], entity_load_single($result['entity_type'], $result['entity_id'])), ':type' => $result['entity_type'], ':id' => $result['entity_id'], '!message' => $result['message']);
         } else {
             $message = '!message';
             $arguments = array('!message' => $result['message']);
         }
         drupal_set_message(t($message, $arguments), $result['type']);
     }
 }
开发者ID:sammarks,项目名称:publisher,代码行数:22,代码来源:Operation.php


示例7: hookTokens

 /**
  * {@inheritdoc}
  */
 public function hookTokens($type, $tokens, array $data = array(), array $options = array())
 {
     $replacements = array();
     if ($this->isValidTokenType($type)) {
         foreach ($tokens as $name => $original) {
             if ($this->isValidToken($original)) {
                 $entity_id = $this->getEntityIdFromToken($original);
                 $entity_type = $type == 'term' ? 'taxonomy_term' : $type;
                 $entity_info = entity_get_info($entity_type);
                 $entity = $entity_info['load hook']($entity_id);
                 $label = entity_label($entity_type, $entity);
                 $uri = entity_uri($entity_type, $entity);
                 $replacements[$original] = l($label, $uri['path'], array('absolute' => TRUE));
             }
         }
     }
     return $replacements;
 }
开发者ID:janoka,项目名称:platform-dev,代码行数:21,代码来源:LinkTokenHandler.php


示例8: action_feedback_title

function action_feedback_title()
{
    $transaction = TransactionSession::getFromSession();
    if ($transaction) {
        $entities = $transaction->getRootEntities();
        $entity = reset($entities);
        /** @var \Drupal\publisher\Entity $entity_object */
        $entity_object = $entity['entity'];
        $entity_section = entity_label($entity_object->type(), $entity_object->definition);
        if (count($entities) > 1) {
            $entity_section .= ' and ' . (count($entities) - 1) . ' others';
        }
        if ($entity_section !== false) {
            $title = t('Select dependencies of %entity to send...', array('%entity' => $entity_section));
            drupal_set_title($title, PASS_THROUGH);
            return $title;
        }
    }
    return false;
}
开发者ID:sammarks,项目名称:publisher,代码行数:20,代码来源:send.php


示例9: build

 public function build($form, &$form_state)
 {
     $headers = array('Entity');
     $rows = array();
     $transaction = TransactionSession::getFromSession();
     if ($transaction !== false) {
         $remote = $transaction->getRemote();
         $root_entities = $transaction->getRootEntities();
         $form['current_session'] = array('#type' => 'fieldset', '#title' => t('Current Session'));
         $form['current_session']['remote'] = array('#type' => 'html_tag', '#tag' => 'p', '#value' => t('Currently sending <strong>!count</strong> entities to <strong>:remote</strong>', array('!count' => count($root_entities), ':remote' => $remote->label)));
         foreach ($root_entities as $root_entity) {
             /** @var Entity $entity */
             $entity = $root_entity['entity'];
             $uri = entity_uri($entity->type(), $entity->definition);
             $url = ltrim($uri['path'], '/');
             $rows[] = array(l(entity_label($entity->type(), $entity->definition), $url));
         }
         $form['current_session']['clear'] = array('#type' => 'submit', '#value' => 'Clear Session');
     }
     $form['table'] = array('#theme' => 'table', '#header' => $headers, '#rows' => $rows, '#empty' => t('There is currently no pending publisher session.'));
     return $form;
 }
开发者ID:sammarks,项目名称:publisher,代码行数:22,代码来源:SessionForm.php


示例10: redesign_activity_property_skills_getter_callback

/**
 * Getter callback for skills property.
 */
function redesign_activity_property_skills_getter_callback($item)
{
    $skill_list = array();
    if ($item->type == 'activity') {
        // Start a new EFQ
        $query = new EntityFieldQuery();
        $query->entityCondition('entity_type', 'node')->entityCondition('bundle', 'skill')->fieldCondition('field_activity', 'target_id', $item->nid, '=');
        $result = $query->execute();
        // If results are returned, it will be in node key
        if (isset($result['node'])) {
            $nids = array_keys($result['node']);
            // Load all the nodes that were returned.
            $skills = node_load_multiple($nids, array('type' => 'skill'));
            $skill_list = array();
            // Build array of node titles.
            foreach ($skills as $skill) {
                // Unlinked title of the node.
                $skill_list[] = entity_label('node', $skill);
            }
        }
    }
    return $skill_list;
}
开发者ID:jmartinsen,项目名称:ts_recipes,代码行数:26,代码来源:custom_field_search.php


示例11: overviewTableRow

 protected function overviewTableRow($conditions, $id, $entity, $additional_cols = array())
 {
     $entity_uri = entity_uri($this->entityType, $entity);
     $row[] = array('data' => array('#theme' => 'entity_ui_overview_item', '#label' => entity_label($this->entityType, $entity), '#name' => !empty($this->entityInfo['exportable']) ? entity_id($this->entityType, $entity) : FALSE, '#url' => $entity_uri ? $entity_uri : FALSE, '#entity_type' => $this->entityType));
     // Add in any passed additional cols.
     foreach ($additional_cols as $col) {
         $row[] = $col;
     }
     // Add a row for the exportable status.
     if (!empty($this->entityInfo['exportable'])) {
         $row[] = array('data' => array('#theme' => 'entity_status', '#status' => $entity->{$this->statusKey}));
     }
     // In case this is a bundle, we add links to the field ui tabs.
     $field_ui = !empty($this->entityInfo['bundle of']) && entity_type_is_fieldable($this->entityInfo['bundle of']) && module_exists('field_ui');
     // For exportable entities we add an export link.
     $exportable = !empty($this->entityInfo['exportable']);
     // If i18n integration is enabled, add a link to the translate tab.
     $i18n = !empty($this->entityInfo['i18n controller class']);
     // Add operations depending on the status.
     if (entity_has_status($this->entityType, $entity, ENTITY_FIXED)) {
         $row[] = array('data' => l(t('clone'), $this->path . '/manage/' . $id . '/clone'), 'colspan' => $this->operationCount());
     } else {
         $row[] = l(t('edit'), $this->path . '/manage/' . $id);
         if (empty($this->entityInfo['exportable']) || !entity_has_status($this->entityType, $entity, ENTITY_IN_CODE)) {
             $row[] = l(t('delete'), $this->path . '/manage/' . $id . '/delete', array('query' => drupal_get_destination()));
         } else {
             $row[] = '';
         }
     }
     if ($exportable) {
         $row[] = l(t('export'), $this->path . '/manage/' . $id . '/export');
     }
     $row[] = $entity->product_quantity;
     $row[] = l(t('quick+1'), '/product/' . $id . '/add/1');
     $row[] = l(t('quick-1'), '/product/' . $id . '/sub/1');
     return $row;
 }
开发者ID:scothiam,项目名称:d7_entities,代码行数:37,代码来源:ProductEntityUIController.php


示例12: hookTokens

 /**
  * {@inheritdoc}
  */
 public function hookTokens($type, $tokens, array $data = array(), array $options = array())
 {
     $replacements = array();
     if ($this->isValidTokenType($type)) {
         foreach ($tokens as $name => $original) {
             if ($this->isValidToken($original)) {
                 $entity_id = $this->getEntityIdFromToken($original);
                 $entity_type = $type == 'term' ? 'taxonomy_term' : $type;
                 $entity_info = entity_get_info($entity_type);
                 // Check if the entity is available.
                 if ($entity = $entity_info['load hook']($entity_id)) {
                     $label = entity_label($entity_type, $entity);
                     $uri = entity_uri($entity_type, $entity);
                     $replacements[$original] = l($label, $uri['path'], array('absolute' => TRUE));
                 } else {
                     $this->watchdogTokenNotFound($data, $original);
                     // Return an empty replacement to not show a broken link.
                     $replacements[$original] = '';
                 }
             }
         }
     }
     return $replacements;
 }
开发者ID:ec-europa,项目名称:platform-dev,代码行数:27,代码来源:LinkTokenHandler.php


示例13: label

 /**
  * {@inheritdoc}
  */
 public function label()
 {
     return entity_label('node', $this);
 }
开发者ID:makinacorpus,项目名称:drupal-sf-dic,代码行数:7,代码来源:Node.php


示例14: buildLabel

 /**
  * Build the label that will be used in the search result for each row.
  */
 function buildLabel($entity)
 {
     return entity_label($this->plugin['entity_type'], $entity);
 }
开发者ID:odsherred,项目名称:subsites.odsherred.dk,代码行数:7,代码来源:linkit-plugin-entity.class.php


示例15: getReferencableEntities

  /**
   * Implements EntityReferenceHandler::getReferencableEntities().
   */
  public function getReferencableEntities($match = NULL, $match_operator = 'CONTAINS', $limit = 0) {
    if ($match || $limit) {
      return parent::getReferencableEntities($match , $match_operator, $limit);
    }

    $options = array();
    $entity_type = $this->field['settings']['target_type'];

    // We imitate core by calling taxonomy_get_tree().
    $entity_info = entity_get_info('taxonomy_term');
    $bundles = !empty($this->field['settings']['handler_settings']['target_bundles']) ? $this->field['settings']['handler_settings']['target_bundles'] : array_keys($entity_info['bundles']);

    foreach ($bundles as $bundle) {
      if ($vocabulary = taxonomy_vocabulary_machine_name_load($bundle)) {
        if ($terms = taxonomy_get_tree($vocabulary->vid, 0, NULL, TRUE)) {
          foreach ($terms as $term) {
            $options[$vocabulary->machine_name][$term->tid] = str_repeat('-', $term->depth) . check_plain(entity_label('taxonomy_term', $term));
          }
        }
      }
    }

    return $options;
  }
开发者ID:humanitarianresponse,项目名称:site,代码行数:27,代码来源:EntityReference_SelectionHandler_Generic.class.php


示例16: applyOperation

 /**
  * Overrides the 'revert' action, to not delete the workflows.
  *
  * @see https://www.drupal.org/node/2051079
  * @see https://www.drupal.org/node/1043634
  */
 public function applyOperation($op, $entity)
 {
     $label = entity_label($this->entityType, $entity);
     $vars = array('%entity' => $this->entityInfo['label'], '%label' => $label);
     $id = entity_id($this->entityType, $entity);
     $edit_link = l(t('edit'), $this->path . '/manage/' . $id . '/edit');
     switch ($op) {
         case 'revert':
             // Do not delete the workflow, but recreate features_get_default($entity_type, $module);
             // entity_delete($this->entityType, $id);
             $workflow = $entity;
             $entity_type = $this->entityType;
             $funcname = $workflow->module . '_default_' . $this->entityType;
             $defaults = $funcname();
             // No defaults, no processing.
             if (empty($defaults)) {
                 return;
             }
             foreach ($defaults as $name => $entity) {
                 $existing[$name] = workflow_load($name);
                 // If we got an existing entity with the same name, we reuse its entity id.
                 if (isset($existing[$name])) {
                     // Set the original as later reference.
                     $entity->original = $existing[$name];
                     // As we got an ID, the entity is not new.
                     $entity->wid = $entity->original->wid;
                     unset($entity->is_new);
                     // Update the status to be in code.
                     // $entity->status |= ENTITY_IN_CODE;
                     $entity->status = ENTITY_IN_CODE;
                     // We mark it for being in revert mode.
                     $entity->is_reverted = TRUE;
                     entity_save($entity_type, $entity);
                     unset($entity->is_reverted);
                 }
                 // The rest of the defaults is handled by default implementation.
                 // @see entity_defaults_rebuild()
             }
             watchdog($this->entityType, 'Reverted %entity %label to the defaults.', $vars, WATCHDOG_NOTICE, $edit_link);
             return t('Reverted %entity %label to the defaults.', $vars);
         case 'delete':
         case 'import':
         default:
             return parent::applyOperation($op, $entity);
     }
 }
开发者ID:TabulaData,项目名称:donl_d7,代码行数:52,代码来源:EntityWorkflowUIController.php


示例17: getAllIdentifiers

 /**
  * Overrides Drupal\configuration\Config\Configuration::getAllIdentifiers().
  */
 public static function getAllIdentifiers($component)
 {
     $options = array();
     foreach (entity_load_multiple_by_name($component, FALSE) as $name => $entity) {
         $options[$name] = entity_label($component, $entity);
     }
     return $options;
 }
开发者ID:gnulugtn,项目名称:portal,代码行数:11,代码来源:EntityApiConfiguration.php


示例18: createLabel

 /**
  * Create a label of an entity.
  *
  * @param $entity
  *   The entity to get the label from.
  *
  * @return
  *   The entity label, or FALSE if not found.
  */
 function createLabel($entity)
 {
     return filter_xss(entity_label($this->plugin['entity_type'], $entity));
 }
开发者ID:CuBoulder,项目名称:cu-express-drops-7,代码行数:13,代码来源:entity.class.php


示例19: createLabel

 /**
  * Create a label of an entity.
  *
  * @param $entity
  *   The entity to get the label from.
  *
  * @return
  *   The entity label, or FALSE if not found.
  */
 function createLabel($entity)
 {
     return entity_label($this->plugin['entity_type'], $entity);
 }
开发者ID:chhavi,项目名称:playbox,代码行数:13,代码来源:entity.class.php


示例20: getLabel

 /**
  * Implements EntityReferenceHandler::getLabel().
  */
 public function getLabel($entity)
 {
     return entity_label($this->entity_type, $entity);
 }
开发者ID:rareimagery,项目名称:budhoundapp,代码行数:7,代码来源:EntityReference_SelectionHandler_Commerce_Store.class.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP entity_link函数代码示例发布时间:2022-05-15
下一篇:
PHP entity_id函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap