コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function query()
 {
     // The current payment status item is uniquely identified by the entity ID
     // and the item delta. This plugin is already configured to use the delta
     // for the join. We only need to make sure the entity ID is added to that.
     $this->definition['extra'] = [['field' => 'entity_id', 'left_field' => 'id']];
     parent::query();
 }
コード例 #2
0
  /**
   * {@inheritdoc}
   */
  public function query() {
    if (!($flag = $this->getFlag())) {
      return;
    }

    $this->definition['extra'][] = [
      'field' => 'flag_id',
      'value' => $flag->id(),
      'numeric' => TRUE,
    ];

    if ($this->options['user_scope'] == 'current' && !$flag->isGlobal()) {
      $this->definition['extra'][] = [
        'field' => 'uid',
        'value' => '***CURRENT_USER***',
        'numeric' => TRUE,
      ];
      $flag_roles = user_roles(FALSE, "flag $flag->id()");
      if (isset($flag_roles[RoleInterface::ANONYMOUS_ID])) {
        // Disable page caching for anonymous users.
        \Drupal::service('page_cache_kill_switch')->trigger();

        // Add in the SID from Session API for anonymous users.
        $this->definition['extra'][] = [
          'field' => 'sid',
          'value' => '***FLAG_CURRENT_USER_SID***',
          'numeric' => TRUE,
        ];
      }
    }

    parent::query();
  }