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

PHP entity_extract_ids函数代码示例

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

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



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

示例1: 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


示例2: entity_allows_revisions

 /**
  * Determine if the entity allows revisions.
  */
 public function entity_allows_revisions($entity)
 {
     $retval = array();
     list($entity_id, $revision_id, $bundle) = entity_extract_ids($this->entity_type, $entity);
     $node_options = variable_get('node_options_' . $bundle, array('status', 'promote'));
     $retval[0] = in_array('revision', $node_options);
     $retval[1] = user_access('administer nodes');
     return $retval;
 }
开发者ID:rexxllabore,项目名称:d7-commons-sanbox,代码行数:12,代码来源:PanelizerEntityNode.class.php


示例3: __construct

 /**
  * Constructor
  *
  * @param string $eventName
  * @param string $entityType
  * @param EntityInterface $entity
  * @param int $userId
  * @param array $arguments
  */
 public function __construct($eventName, $entityType, EntityInterface $entity, $userId = null, array $arguments = [])
 {
     $this->setEventName($eventName);
     $this->setEntityType($entityType);
     $this->setUserId($userId);
     list($id, , $bundle) = entity_extract_ids($entityType, $entity);
     // Keeping the 'uid' in arguments allows compatibility with the
     // makinacorpus/apubsub API, using subject too
     parent::__construct($entity, $arguments + ['uid' => $userId, 'id' => $id, 'bundle' => $bundle]);
 }
开发者ID:makinacorpus,项目名称:drupal-sf-dic,代码行数:19,代码来源:EntityEvent.php


示例4: generate

 /**
  * Implements EditMetadataGeneratorInterface::generate().
  */
 public function generate($entity_type, $entity, array $instance, $langcode, $view_mode)
 {
     $field_name = $instance['field_name'];
     // Early-return if user does not have access.
     $access = $this->accessChecker->accessEditEntityField($entity_type, $entity, $field_name);
     if (!$access) {
         return array('access' => FALSE);
     }
     // Early-return if no editor is available.
     if (!_edit_is_extra_field($entity_type, $field_name)) {
         $display = field_get_display($instance, $view_mode, $entity);
         $formatter_type = field_info_formatter_types($display['type']);
         $items = field_get_items($entity_type, $entity, $field_name, $langcode);
         $items = $items === FALSE ? array() : $items;
         $editor_id = $this->editorSelector->getEditor($formatter_type, $instance, $items);
     } else {
         // @see hook_edit_extra_fields_info()
         $extra = edit_extra_field_info($entity_type, $field_name);
         if (isset($extra['view mode dependent editor'][$view_mode])) {
             $editor_id = $extra['view mode dependent editor'][$view_mode];
         } else {
             $editor_id = $extra['default editor'];
         }
     }
     if (!isset($editor_id)) {
         return array('access' => FALSE);
     }
     // Gather metadata, allow the editor to add additional metadata of its own.
     if (!_edit_is_extra_field($entity_type, $field_name)) {
         $label = $instance['label'];
     } else {
         $label = edit_extra_field_info($entity_type, $field_name, 'label');
     }
     list($id, $vid, $bundle) = entity_extract_ids($entity_type, $entity);
     $metadata = array('label' => check_plain($label), 'access' => TRUE, 'editor' => $editor_id, 'aria' => t('Entity @type @id, field @field', array('@type' => $entity_type, '@id' => $id, '@field' => $label)));
     if (!_edit_is_extra_field($entity_type, $field_name)) {
         $editor = edit_editor_get($editor_id);
         if (!empty($editor['metadata callback'])) {
             if ($editor['file']) {
                 require_once $editor['file path'] . '/' . $editor['file'];
             }
             if (function_exists($editor['metadata callback'])) {
                 $custom_metadata = $editor['metadata callback']($instance, $items);
                 if (count($custom_metadata)) {
                     $metadata['custom'] = $custom_metadata;
                 }
             }
         }
         // Allow the metadata to be altered.
         $context = array('entity_type' => $entity_type, 'entity' => $entity, 'field' => $instance, 'items' => $items);
         drupal_alter('edit_editor_metadata', $metadata, $editor_id, $context);
     }
     return $metadata;
 }
开发者ID:edysmp,项目名称:fullnessofdays,代码行数:57,代码来源:EditMetadataGenerator.php


示例5: hook_linked_field_settings_alter

/**
 * Act on Linked Field settings
 *
 * This hook is invoked from linked_field_field_attach_view_alter() when linking
 * a field. It allows you to override all settings.
 *
 * @param $settings
 *   An associative array of Linked Field settings.
 * @param $context
 *   An associative array containing:
 *   - entity_type: The type of $entity; for example, 'node' or 'user'.
 *   - entity: The entity with fields to render.
 *   - view_mode: View mode; for example, 'full' or 'teaser'.
 *   - display: Either a view mode string or an array of display settings. If
 *     this hook is being invoked from field_attach_view(), the 'display'
 *     element is set to the view mode string. If this hook is being invoked
 *     from field_view_field(), this element is set to the $display argument
 *     and the view_mode element is set to '_custom'. See field_view_field()
 *     for more information on what its $display argument contains.
 *   - language: The language code used for rendering.
 */
function hook_linked_field_settings_alter(&$settings, $context)
{
    $entity_type = $context['entity_type'];
    $entity = $context['entity'];
    list(, , $bundle) = entity_extract_ids($entity_type, $entity);
    $view_mode = $context['view_mode'];
    // Add custom attribute for the link.
    if ($entity_type == 'node' && $bundle == 'article' && $view_mode == 'default') {
        $settings['options']['attributes']['data-id'] = $entity->nid;
    }
}
开发者ID:creazy412,项目名称:vmware-win10-c65-drupal7,代码行数:32,代码来源:linked_field.api.php


示例6: entity_allows_revisions

 /**
  * Determine if the entity allows revisions.
  */
 public function entity_allows_revisions($entity)
 {
     $retval = array();
     list($entity_id, $revision_id, $bundle) = entity_extract_ids($this->entity_type, $entity);
     $node_options = variable_get('node_options_' . $bundle, array('status', 'promote'));
     // Whether or not the entity supports revisions.
     $retval[0] = TRUE;
     // Whether or not the user can control if a revision is created.
     $retval[1] = user_access('administer nodes');
     // Whether or not the revision is created by default.
     $retval[2] = in_array('revision', $node_options);
     return $retval;
 }
开发者ID:Probo-Demos,项目名称:drupal_github,代码行数:16,代码来源:PanelizerEntityNode.class.php


示例7: buildListCache

 /**
  * Prepare internal bundle and id list cache
  */
 private function buildListCache()
 {
     if (null !== $this->idList) {
         return;
     }
     foreach ($this->subject as $entity) {
         list($id, , $bundle) = entity_extract_ids($this->getEntityType(), $entity);
         $this->idList[] = $id;
         $this->bundleList[$id] = $bundle;
         $this->bundleList = $bundle;
         $this->bundleList = array_unique($this->bundleList);
     }
 }
开发者ID:makinacorpus,项目名称:drupal-sf-dic,代码行数:16,代码来源:EntityCollectionEvent.php


示例8: entityFormSubmit

 /**
  * Overrides EntityInlineEntityFormController::entityFormSubmit().
  *
  * Fixes some of the custom entity values, similar to
  * fieldable_panels_panes_entity_edit_form_submit().
  */
 public function entityFormSubmit(&$entity_form, &$form_state)
 {
     $info = entity_get_info($this->entityType);
     list(, , $bundle) = entity_extract_ids($this->entityType, $entity_form['#entity']);
     $entity = $entity_form['#entity'];
     $entity_values = drupal_array_get_nested_value($form_state['values'], $entity_form['#parents']);
     // Some additional adjustments necessary for FPP to save correctly.
     if (!empty($entity_values['link']['path'])) {
         $entity_values['path'] = $entity_values['link']['path'];
     }
     if (isset($entity_values['link']['link'])) {
         $entity_values['link'] = $entity_values['link']['link'];
     } else {
         $entity_values['link'] = 0;
     }
     // The 'reusable' option contains several sub fields.
     if (isset($entity_values['reusable']['reusable'])) {
         $reusable = $entity_values['reusable'];
         $entity_values['reusable'] = FALSE;
         $entity_values['category'] = '';
         $entity_values['admin_title'] = '';
         $entity_values['admin_description'] = '';
         foreach (array('reusable', 'category', 'admin_title', 'admin_description') as $field) {
             if (isset($reusable[$field])) {
                 $entity_values[$field] = $reusable[$field];
             }
         }
     }
     // Only fix the revision log if a revision is being saved.
     $entity_values['log'] = '';
     if (isset($entity_values['revision']['revision'])) {
         if (isset($entity_values['revision']['log'])) {
             $entity_values['log'] = $entity_values['revision']['log'];
         }
         $entity_values['revision'] = $entity_values['revision']['revision'];
     } else {
         $entity_values['revision'] = 0;
     }
     // Copy top-level form values that are not for fields to entity properties,
     // without changing existing entity properties that are not being edited by
     // this form. Copying field values must be done using field_attach_submit().
     $values_excluding_fields = $info['fieldable'] ? array_diff_key($entity_values, field_info_instances($this->entityType, $bundle)) : $entity_values;
     foreach ($values_excluding_fields as $key => $value) {
         $entity->{$key} = $value;
     }
     if ($info['fieldable']) {
         field_attach_submit($this->entityType, $entity, $entity_form, $form_state);
     }
 }
开发者ID:michael-wojcik,项目名称:open_eggheads,代码行数:55,代码来源:FieldablePanelsPaneInlineEntityFormController.class.php


示例9: load

 /**
  * Implements EntityReference_BehaviorHandler_Abstract::load().
  */
 public function load($entity_type, $entities, $field, $instances, $langcode, &$items)
 {
     // Get the OG memberships from the field.
     $field_name = $field['field_name'];
     $target_type = $field['settings']['target_type'];
     foreach ($entities as $entity) {
         list($id) = entity_extract_ids($entity_type, $entity);
         $items[$id] = array();
         $gids = og_get_entity_groups($entity_type, $entity, array(), $field_name);
         if (empty($gids[$target_type])) {
             continue;
         }
         foreach ($gids[$target_type] as $gid) {
             $items[$id][] = array('target_id' => $gid);
         }
     }
 }
开发者ID:redponey,项目名称:openatrium-7.x-2.51,代码行数:20,代码来源:OgBehaviorHandler.class.php


示例10: update

 /**
  * 
  * Do the actual update - passes the update to the plugin's process functions
  */
 function update()
 {
     if (function_exists($this->plugin['process'])) {
         $this->plugin['process']($this);
     }
     // Are there any form errors?
     if ($errors = form_get_errors()) {
         foreach ($errors as $error) {
             // Form errors will apply for all entities
             foreach ($this->entities as $entity) {
                 list($id) = entity_extract_ids($this->entity_type, $entity);
                 $this->set_error($id, $error);
             }
         }
     }
     return $this->get_result();
 }
开发者ID:acquiau-2015,项目名称:acquiau-site,代码行数:21,代码来源:handler.class.php


示例11: entityForm

 /**
  * Overrides EntityInlineEntityFormController::entityForm().
  *
  * Copied from fieldable_panels_panes_entity_edit_form().
  */
 public function entityForm($entity_form, &$form_state)
 {
     // Make the other form items dependent upon it.
     ctools_include('dependent');
     ctools_add_js('dependent');
     $entity = $entity_form['#entity'];
     $entity_type = 'fieldable_panels_pane';
     list(, , $bundle) = entity_extract_ids($entity_type, $entity);
     // Map these properties for entity translations.
     $entity_form['#entity_type'] = array('#type' => 'value', '#value' => $entity->bundle);
     $form_state['fieldable_panels_pane'] = $entity_form['#entity'];
     $entity_form['title'] = array('#type' => 'textfield', '#title' => t('Title'), '#default_value' => $entity->title, '#weight' => -10);
     $entity_form['language'] = array('#type' => 'value', '#value' => $entity->language);
     $entity_form['link'] = array('#weight' => -10);
     $entity_form['link']['link'] = array('#title' => t('Make title a link'), '#type' => 'checkbox', '#default_value' => $entity->link, '#description' => t('Check here to make the title link to another page.'), '#id' => 'edit-link');
     $entity_form['link']['path'] = array('#type' => 'textfield', '#title' => t('Path'), '#description' => t('The path for this link. This can be an internal Drupal path such as %add-node or an external URL such as %drupal. Enter %front to link to the front page.', array('%front' => '<front>', '%add-node' => 'node/add', '%drupal' => 'http://drupal.org')), '#dependency' => array('edit-link' => array(1)), '#default_value' => $entity->path);
     $entity_form['reusable'] = array('#weight' => 10);
     $entity_form['revision'] = array('#weight' => 11);
     if (empty($entity->fpid)) {
         $entity_form['revision']['#access'] = FALSE;
     }
     $entity_form['reusable']['reusable'] = array('#type' => 'checkbox', '#title' => t('Make this entity reusable'), '#default_value' => $entity->reusable, '#id' => 'edit-reusable');
     $entity_form['reusable']['category'] = array('#type' => 'textfield', '#title' => t('Category'), '#description' => t('The category this content will appear in the "Add content" modal. If left blank the category will be "Miscellaneous".'), '#dependency' => array('edit-reusable' => array(1)), '#default_value' => $entity->category);
     $entity_form['reusable']['admin_title'] = array('#type' => 'textfield', '#title' => t('Administrative title'), '#description' => t('The name this content will appear in the "Add content" modal.'), '#dependency' => array('edit-reusable' => array(1)), '#default_value' => $entity->admin_title);
     $entity_form['reusable']['admin_description'] = array('#type' => 'textarea', '#title' => t('Administrative description'), '#description' => t('A description of what this content is, does or is for, for administrative use.'), '#dependency' => array('edit-reusable' => array(1)), '#default_value' => $entity->admin_description);
     $entity_form['revision']['revision'] = array('#type' => 'checkbox', '#title' => t('Create new revision'), '#default_value' => 1, '#id' => 'edit-revision');
     if (!user_access('administer fieldable panels panes') || empty($entity->fpid) || $entity->vid != $entity->current_vid) {
         $form['revision']['revision']['#disabled'] = TRUE;
         $form['revision']['revision']['#value'] = TRUE;
     }
     $entity_form['revision']['log'] = array('#type' => 'textarea', '#title' => t('Log message'), '#description' => t('Provide an explanation of the changes you are making. This will help other authors understand your motivations.'), '#dependency' => array('edit-revision' => array(1)), '#default_value' => '');
     $langcode = entity_language('fieldable_panels_pane', $entity);
     field_attach_form('fieldable_panels_pane', $entity, $entity_form, $form_state, $langcode);
     // _field_extra_fields_pre_render() doesn't execute properly, so manually
     // set the weights.
     $extra_fields = field_info_extra_fields($entity_type, $bundle, 'form');
     foreach ($extra_fields as $name => $settings) {
         if (isset($entity_form[$name])) {
             $entity_form[$name]['#weight'] = $settings['weight'];
         }
     }
     return $entity_form;
 }
开发者ID:robtryson,项目名称:nysits,代码行数:48,代码来源:FieldablePanelsPaneInlineEntityFormController.class.php


示例12: getList

  /**
   * Overrides RestfulEntityBase::getList().
   */
  public function getList() {
    $entity_type = $this->entityType;
    $result = $this
      ->getQueryForList()
      ->execute();


    if (empty($result[$entity_type])) {
      return;
    }

    $account = $this->getAccount();
    $request = $this->getRequest();

    $ids = array_keys($result[$entity_type]);

    // Pre-load all entities.
    $entities = entity_load($entity_type, $ids);

    $return = array();

    $handlers = array();
    $resources_info = $this->getBundles();

    foreach ($entities as $entity) {
      // Call each handler by its registered bundle.
      list($id,, $bundle) = entity_extract_ids($this->getEntityType(), $entity);
      if (empty($handlers[$bundle])) {
        $version = $this->getVersion();
        $handlers[$bundle] = restful_get_restful_handler($resources_info[$bundle], $version['major'], $version['minor']);
      }

      $bundle_handler = $handlers[$bundle];
      $bundle_handler->setAccount($account);
      $bundle_handler->setRequest($request);
      $return[] = $bundle_handler->viewEntity($id);
    }

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


示例13: getReferencableEntities

 /**
  * Implements EntityReferenceHandler::getReferencableEntities().
  */
 public function getReferencableEntities($match = NULL, $match_operator = 'CONTAINS', $limit = 0)
 {
     global $user;
     // For admin users, use the standard plugin behavior.
     if (user_access('assign content ownership')) {
         return parent::getReferencableEntities($match, $match_operator, $limit);
     }
     $options = array();
     if (empty($user->uid)) {
         return $options;
     }
     $uids = array($user->uid);
     if (function_exists('yaffle_delegation_get_delegate_uids')) {
         $uids += yaffle_delegation_get_delegate_uids($user->uid);
     }
     $entities = entity_load($entity_type, array_keys($results[$entity_type]));
     foreach ($entities as $entity_id => $entity) {
         list(, , $bundle) = entity_extract_ids($entity_type, $entity);
         $options[$bundle][$entity_id] = check_plain($this->getLabel($entity));
     }
     // $uids = array($user->uid);
     // $options = array();
     // $entity_type = $this->field['settings']['target_type'];
     // $query = $this->buildEntityFieldQuery($match, $match_operator);
     // if ($limit > 0) {
     //   $query->range(0, $limit);
     // }
     // $results = $query->execute();
     // if (!empty($results[$entity_type])) {
     //   $entities = entity_load($entity_type, array_keys($results[$entity_type]));
     //   foreach ($entities as $entity_id => $entity) {
     //     list(,, $bundle) = entity_extract_ids($entity_type, $entity);
     //     $options[$bundle][$entity_id] = check_plain($this->getLabel($entity));
     //   }
     // }
     return $options;
 }
开发者ID:matthewmaclennan,项目名称:yaffle,代码行数:40,代码来源:YaffleCoreOwnerSelection.class.php


示例14: hook_form_alter

/**
 * Implements hook_form_alter().
 *
 * Use this hook to alter the form on a Node Form, Comment Form (Edit page).
 */
function hook_form_alter(&$form, $form_state, $form_id)
{
    // Get the Entity.
    $entity = $form['#entity'];
    $entity_type = $form['#entity_type'];
    // Use the complicated form, which is suited for all Entity Types.
    list(, , $entity_bundle) = entity_extract_ids($entity_type, $entity);
    // Discover if this is the correct form.
    // ...
    // Get the current state and act upon it.
    // .. copy code from the hook above.
}
开发者ID:Loudon-Company,项目名称:LacunaStories,代码行数:17,代码来源:workflow.api.php


示例15: hook_field_storage_purge

/**
 * Remove field storage information when field data is purged.
 *
 * Called from field_purge_data() to allow the field storage
 * module to delete field data information.
 *
 * @param $entity_type
 *   The type of $entity; for example, 'node' or 'user'.
 * @param $entity
 *   The pseudo-entity whose field data to delete.
 * @param $field
 *   The (possibly deleted) field whose data is being purged.
 * @param $instance
 *   The deleted field instance whose data is being purged.
 */
function hook_field_storage_purge($entity_type, $entity, $field, $instance)
{
    list($id, $vid, $bundle) = entity_extract_ids($entity_type, $entity);
    $table_name = _field_sql_storage_tablename($field);
    $revision_name = _field_sql_storage_revision_tablename($field);
    db_delete($table_name)->condition('entity_type', $entity_type)->condition('entity_id', $id)->execute();
    db_delete($revision_name)->condition('entity_type', $entity_type)->condition('entity_id', $id)->execute();
}
开发者ID:rlugojr,项目名称:livereload-examples,代码行数:23,代码来源:field.api.php


示例16: hook_entity_delete

/**
 * Act on entities when deleted.
 *
 * @param $entity
 *   The entity object.
 * @param $type
 *   The type of entity being deleted (i.e. node, user, comment).
 */
function hook_entity_delete($entity, $type)
{
    // Delete the entity's entry from a fictional table of all entities.
    $info = entity_get_info($type);
    list($id) = entity_extract_ids($type, $entity);
    db_delete('example_entity')->condition('type', $type)->condition('id', $id)->execute();
}
开发者ID:jayelless,项目名称:beehive,代码行数:15,代码来源:system.api.php


示例17: validate

 /**
  * Implements EntityReference_BehaviorHandler_Abstract::validate().
  *
  * Re-build $errors array to be keyed correctly by "default" and "admin" field
  * modes.
  *
  * @todo: Try to get the correct delta so we can highlight the invalid
  * reference.
  *
  * @see entityreference_field_validate().
  */
 public function validate($entity_type, $entity, $field, $instance, $langcode, $items, &$errors)
 {
     $new_errors = array();
     $values = array('default' => array(), 'admin' => array());
     foreach ($items as $item) {
         $values[$item['field_mode']][] = $item['target_id'];
     }
     list(, , $bundle) = entity_extract_ids($entity_type, $entity);
     $field_name = $field['field_name'];
     foreach ($values as $field_mode => $ids) {
         if (!$ids) {
             continue;
         }
         if ($field_mode == 'admin' && !user_access('administer group')) {
             // No need to validate the admin, as the user has no access to it.
             continue;
         }
         $instance['field_mode'] = $field_mode;
         $valid_ids = entityreference_get_selection_handler($field, $instance, $entity_type, $entity)->validateReferencableEntities($ids);
         if ($invalid_entities = array_diff($ids, $valid_ids)) {
             foreach ($invalid_entities as $id) {
                 $new_errors[$field_mode][] = array('error' => 'og_invalid_entity', 'message' => t('The referenced group (@type: @id) is invalid.', array('@type' => $field['settings']['target_type'], '@id' => $id)));
             }
         }
     }
     if ($new_errors) {
         og_field_widget_register_errors($field_name, $new_errors);
     }
     $errors = array();
 }
开发者ID:cesardmoro,项目名称:openatrium-2-quickstart,代码行数:41,代码来源:OgBehaviorHandler.class.php


示例18: hook_field_attach_submit

 /**
  * Implements hook_field_attach_submit().
  */
 public function hook_field_attach_submit($entity, &$form, &$form_state)
 {
     // Call parent.
     parent::hook_field_attach_submit($entity, $form, $form_state);
     // Save paragraph item panelizer settings.
     if (!empty($form_state['panelizer has choice'])) {
         list($entity_id, $revision_id, $bundle) = entity_extract_ids($this->entity_type, $entity);
         foreach ($this->plugin['view modes'] as $view_mode => $view_mode_info) {
             if (isset($form['#parents']) && drupal_array_nested_key_exists($form_state['values'], $form['#parents'])) {
                 $values = drupal_array_get_nested_value($form_state['values'], $form['#parents']);
                 if (isset($values['panelizer'][$view_mode]['name'])) {
                     $entity->panelizer[$view_mode] = clone $this->get_default_panelizer_object($bundle . '.' . $view_mode, $values['panelizer'][$view_mode]['name']);
                     if (!empty($entity->panelizer[$view_mode])) {
                         $entity->panelizer[$view_mode]->did = NULL;
                         // Ensure original values are maintained, if they exist.
                         if (isset($form['panelizer'][$view_mode]['name'])) {
                             $entity->panelizer[$view_mode]->entity_id = $form['panelizer'][$view_mode]['name']['#entity_id'];
                             $entity->panelizer[$view_mode]->revision_id = $form['panelizer'][$view_mode]['name']['#revision_id'];
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:drupalconnect,项目名称:finsearches,代码行数:28,代码来源:PanelizerEntityParagraphsItem.class.php


示例19: hook_entity_postdelete

/**
 * Gets called after an entity has been deleted from database.
 *
 * @param $entity
 *   An entity object
 * @param string $entity
 *   An string containing entity type name
 *
 * @see hook_entity_postsave()
 * @see hook_entity_postinsert()
 * @see hook_entity_postupdate()
 * @ingroup entity_api_hooks
 */
function hook_entity_postdelete($entity, $entity_type)
{
    list($id) = entity_extract_ids($entity_type, $entity);
    watchdog('hook_post_action_test', "The deleted entity {$entity_type} id is {$id} from " . __FUNCTION__);
}
开发者ID:samknelson,项目名称:grievance,代码行数:18,代码来源:hook_post_action.api.php


示例20: favrskovtheme_date_display_combination

/**
 * Overrides theme_date_display_combination().
 */
function favrskovtheme_date_display_combination($variables)
{
    static $repeating_ids = array();
    $entity_type = $variables['entity_type'];
    $entity = $variables['entity'];
    $field = $variables['field'];
    $instance = $variables['instance'];
    $langcode = $variables['langcode'];
    $item = $variables['item'];
    $delta = $variables['delta'];
    $display = $variables['display'];
    $field_name = $field['field_name'];
    $formatter = $display['type'];
    $options = $display['settings'];
    $dates = $variables['dates'];
    $attributes = $variables['attributes'];
    $rdf_mapping = $variables['rdf_mapping'];
    $add_rdf = $variables['add_rdf'];
    $precision = date_granularity_precision($field['settings']['granularity']);
    $output = '';
    // If date_id is set for this field and delta doesn't match, don't display it.
    if (!empty($entity->date_id)) {
        foreach ((array) $entity->date_id as $key => $id) {
            list($module, $nid, $field_name, $item_delta, $other) = explode('.', $id . '.');
            if ($field_name == $field['field_name'] && isset($delta) && $item_delta != $delta) {
                return $output;
            }
        }
    }
    // Check the formatter settings to see if the repeat rule should be displayed.
    // Show it only with the first multiple value date.
    list($id) = entity_extract_ids($entity_type, $entity);
    if (!in_array($id, $repeating_ids) && module_exists('date_repeat_field') && !empty($item['rrule']) && $options['show_repeat_rule'] == 'show') {
        $repeat_vars = array('field' => $field, 'item' => $item, 'entity_type' => $entity_type, 'entity' => $entity);
        $output .= theme('date_repeat_display', $repeat_vars);
        $repeating_ids[] = $id;
    }
    // If this is a full node or a pseudo node created by grouping multiple
    // values, see exactly which values are supposed to be visible.
    if (isset($entity->{$field_name})) {
        $entity = date_prepare_entity($formatter, $entity_type, $entity, $field, $instance, $langcode, $item, $display);
        // Did the current value get removed by formatter settings?
        if (empty($entity->{$field_name}[$langcode][$delta])) {
            return $output;
        }
        // Adjust the $element values to match the changes.
        $element['#entity'] = $entity;
    }
    switch ($options['fromto']) {
        case 'value':
            $date1 = $dates['value']['formatted'];
            $date2 = $date1;
            break;
        case 'value2':
            $date2 = $dates['value2']['formatted'];
            $date1 = $date2;
            break;
        default:
            $date1 = $dates['value']['formatted'];
            $date2 = $dates['value2']['formatted'];
            break;
    }
    // Pull the timezone, if any, out of the formatted result and tack it back on
    // at the end, if it is in the current formatted date.
    $timezone = $dates['value']['formatted_timezone'];
    if ($timezone) {
        $timezone = ' ' . $timezone;
    }
    $date1 = str_replace($timezone, '', $date1);
    $date2 = str_replace($timezone, '', $date2);
    $time1 = preg_replace('`^([\\(\\[])`', '', $dates['value']['formatted_time']);
    $time1 = preg_replace('([\\)\\]]$)', '', $time1);
    $time2 = preg_replace('`^([\\(\\[])`', '', $dates['value2']['formatted_time']);
    $time2 = preg_replace('([\\)\\]]$)', '', $time2);
    // A date with a granularity of 'hour' has a time string that is an integer
    // value. We can't use that to replace time strings in formatted dates.
    $has_time_string = date_has_time($field['settings']['granularity']);
    if ($precision == 'hour') {
        $has_time_string = FALSE;
    }
    // No date values, display nothing.
    if (empty($date1) && empty($date2)) {
        $output .= '';
    } elseif ($date1 == $date2 || empty($date2)) {
        $output .= theme('date_display_single', array('date' => $date1, 'timezone' => $timezone, 'attributes' => $attributes, 'rdf_mapping' => $rdf_mapping, 'add_rdf' => $add_rdf, 'dates' => $dates));
    } else {
        $output .= theme('date_display_range', array('date1' => $date1, 'date2' => $date2, 'timezone' => $timezone, 'attributes' => $attributes, 'rdf_mapping' => $rdf_mapping, 'add_rdf' => $add_rdf, 'dates' => $dates));
    }
    return $output;
}
开发者ID:GitError404,项目名称:favrskov.dk,代码行数:93,代码来源:template.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP entity_get_bundles函数代码示例发布时间:2022-05-15
下一篇:
PHP entity_delete_multiple函数代码示例发布时间: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