本文整理汇总了PHP中entity_label函数的典型用法代码示例。如果您正苦于以下问题:PHP entity_label函数的具体用法?PHP entity_label怎么用?PHP entity_label使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了entity_label函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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).')';
}
示例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));
}
示例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;
}
示例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]));
}
示例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;
}
示例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']);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例13: label
/**
* {@inheritdoc}
*/
public function label()
{
return entity_label('node', $this);
}
示例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);
}
示例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