Commit 6ec6ff7d authored by Teun van Veggel's avatar Teun van Veggel Committed by Wolfgang Ziegler
Browse files

Issue #1989444 by nuez, djdevin: Views integration for properties of type = duration does not work

parent 435f1e61
Loading
Loading
Loading
Loading
+6 −1
Changes for includes/entity.wrapper.inc: 6 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -844,7 +844,12 @@ class EntityDrupalWrapper extends EntityStructureWrapper {
    }
    else {
      // This is not a property, so fallback on entity access.
      return $this->entityAccess($op == 'edit' ? 'update' : 'view', $account);
      if ($op == 'edit') {
        // If the operation is "edit" determine if its actually a "create" for
        // new un-saved entities, or an "update" for existing ones.
        return $this->entityAccess($this->getIdentifier() ? 'update' : 'create', $account);
      }
      return $this->entityAccess('view', $account);
    }
  }

+4 −2
Changes for modules/callbacks.inc: 4 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -670,9 +670,11 @@ function entity_metadata_field_file_validate_item($items, $context) {
function entity_metadata_no_hook_node_access($op, $node = NULL, $account = NULL) {
  // First deal with the case where a $node is provided.
  if (isset($node)) {
    if ($op == 'create') {
    if (empty($node->vid) && in_array($op, array('create', 'update'))) {
      // This is a new node or the original node.
      if (isset($node->type)) {
        return node_access($op, $node->type, $account);
        $op = !empty($node->is_new) && $node->is_new ? 'create' : 'update';
        return node_access($op, $op == 'create' ? $node->type : $node, $account);
      }
      else {
        throw new EntityMalformedException('Permission to create a node was requested but no node type was given.');
+22 −0
Changes for views/entity.views.inc: 22 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -605,6 +605,28 @@ class EntityDefaultViewsController {
        );
      break;

      case 'duration':
        $return += $description + array(
          'field' => array(
            'real field' => $views_field_name,
            'handler' => 'entity_views_handler_field_duration',
            'click sortable' => TRUE,
           ),
          'sort' => array(
            'real field' => $views_field_name,
            'handler' => 'views_handler_sort',
          ),
          'filter' => array(
            'real field' => $views_field_name,
            'handler' => 'views_handler_filter_numeric',
          ),
          'argument' => array(
            'real field' => $views_field_name,
            'handler' => 'views_handler_argument_numeric',
          ),
        );
      break;

      case 'uri':
        $return += $description + array(
          'field' => array(
+2 −2
Changes for views/handlers/entity_views_field_handler_helper.inc: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@ class EntityFieldHandlerHelper {
   * Provide appropriate default options for a handler.
   */
  public static function option_definition($handler) {
    if (entity_property_list_extract_type($handler->definition['type'])) {
    if (isset($handler->definition['type']) && entity_property_list_extract_type($handler->definition['type'])) {
      $options['list']['contains']['mode'] = array('default' => 'collapse');
      $options['list']['contains']['separator'] = array('default' => ', ');
      $options['list']['contains']['type'] = array('default' => 'ul');
@@ -32,7 +32,7 @@ class EntityFieldHandlerHelper {
   * Provide an appropriate default option form for a handler.
   */
  public static function options_form($handler, &$form, &$form_state) {
    if (entity_property_list_extract_type($handler->definition['type'])) {
    if (isset($handler->definition['type']) && entity_property_list_extract_type($handler->definition['type'])) {
      $form['list']['mode'] = array(
        '#type' => 'select',
        '#title' => t('List handling'),