Drupal 8.0.0 beta 12. More info: https://www.drupal.org/node/2514176

This commit is contained in:
Pantheon Automation 2015-08-17 17:00:26 -07:00 committed by Greg Anderson
commit 9921556621
13277 changed files with 1459781 additions and 0 deletions

View file

@ -0,0 +1,48 @@
<?php
/**
* @file
* Contains \Drupal\tracker\Plugin\Menu\UserTrackerTab.
*/
namespace Drupal\tracker\Plugin\Menu;
use Drupal\Core\Menu\LocalTaskDefault;
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Provides route parameters needed to link to the current user tracker tab.
*/
class UserTrackerTab extends LocalTaskDefault {
/**
* Current user object.
*
* @var \Drupal\Core\Session\AccountInterface
*/
protected $currentUser;
/**
* Gets the current active user.
*
* @todo: https://www.drupal.org/node/2105123 put this method in
* \Drupal\Core\Plugin\PluginBase instead.
*
* @return \Drupal\Core\Session\AccountInterface
*/
protected function currentUser() {
if (!$this->currentUser) {
$this->currentUser = \Drupal::currentUser();
}
return $this->currentUser;
}
/**
* {@inheritdoc}
*/
public function getRouteParameters(RouteMatchInterface $route_match) {
return array('user' => $this->currentUser()->Id());
}
}

View file

@ -0,0 +1,32 @@
<?php
/**
* @file
* Contains \Drupal\tracker\Plugin\views\argument\UserUid.
*/
namespace Drupal\tracker\Plugin\views\argument;
use Drupal\comment\Plugin\views\argument\UserUid as CommentUserUid;
/**
* UID argument to check for nodes that user posted or commented on.
*
* @ingroup views_argument_handlers
*
* @ViewsArgument("tracker_user_uid")
*/
class UserUid extends CommentUserUid {
/**
* {@inheritdoc}
*/
public function query($group_by = FALSE) {
// Because this handler thinks it's an argument for a field on the {node}
// table, we need to make sure {tracker_user} is JOINed and use its alias
// for the WHERE clause.
$tracker_user_alias = $this->query->ensureTable('tracker_user');
$this->query->addWhere(0, "$tracker_user_alias.uid", $this->argument);
}
}

View file

@ -0,0 +1,33 @@
<?php
/**
* @file
* Contains \Drupal\tracker\Plugin\views\filter\UserUid.
*/
namespace Drupal\tracker\Plugin\views\filter;
use Drupal\user\Plugin\views\filter\Name;
/**
* UID filter to check for nodes that a user posted or commented on.
*
* @ingroup views_filter_handlers
*
* @ViewsFilter("tracker_user_uid")
*/
class UserUid extends Name {
/**
* {@inheritdoc}
*/
public function query() {
// Because this handler thinks it's an argument for a field on the {node}
// table, we need to make sure {tracker_user} is JOINed and use its alias
// for the WHERE clause.
$tracker_user_alias = $this->query->ensureTable('tracker_user');
// Cast scalars to array so we can consistently use an IN condition.
$this->query->addWhere(0, "$tracker_user_alias.uid", (array) $this->value, 'IN');
}
}