updated contrib modules
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Views' relationship handlers.
|
||||
* Definition of views_handler_relationship.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -12,12 +12,11 @@
|
||||
*/
|
||||
|
||||
/**
|
||||
* Simple relationship handler that allows a new version of the primary table
|
||||
* to be linked in.
|
||||
* Relationship handler, allows a new version of the primary table to be linked.
|
||||
*
|
||||
* The base relationship handler can only handle a single join. Some relationships
|
||||
* are more complex and might require chains of joins; for those, you must
|
||||
* utilize a custom relationship handler.
|
||||
* The base relationship handler can only handle a single join. Some
|
||||
* relationships are more complex and might require chains of joins; for those,
|
||||
* you must use a custom relationship handler.
|
||||
*
|
||||
* Definition items:
|
||||
* - base: The new base table this relationship will be adding. This does not
|
||||
@@ -36,18 +35,18 @@
|
||||
* @ingroup views_relationship_handlers
|
||||
*/
|
||||
class views_handler_relationship extends views_handler {
|
||||
|
||||
/**
|
||||
* Init handler to let relationships live on tables other than
|
||||
* the table they operate on.
|
||||
* Let relationships live on tables other than the table they operate on.
|
||||
*/
|
||||
function init(&$view, &$options) {
|
||||
public function init(&$view, &$options) {
|
||||
parent::init($view, $options);
|
||||
if (isset($this->definition['relationship table'])) {
|
||||
$this->table = $this->definition['relationship table'];
|
||||
}
|
||||
if (isset($this->definition['relationship field'])) {
|
||||
// Set both real_field and field so custom handler
|
||||
// can rely on the old field value.
|
||||
// Set both real_field and field so custom handler can rely on the old
|
||||
// field value.
|
||||
$this->real_field = $this->field = $this->definition['relationship field'];
|
||||
}
|
||||
}
|
||||
@@ -55,18 +54,22 @@ class views_handler_relationship extends views_handler {
|
||||
/**
|
||||
* Get this field's label.
|
||||
*/
|
||||
function label() {
|
||||
public function label() {
|
||||
if (!isset($this->options['label'])) {
|
||||
return $this->ui_name();
|
||||
}
|
||||
return $this->options['label'];
|
||||
}
|
||||
|
||||
function option_definition() {
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function option_definition() {
|
||||
$options = parent::option_definition();
|
||||
|
||||
|
||||
// Relationships definitions should define a default label, but if they aren't get another default value.
|
||||
// Relationships definitions should define a default label, but if they
|
||||
// aren't get another default value.
|
||||
if (!empty($this->definition['label'])) {
|
||||
$label = $this->definition['label'];
|
||||
}
|
||||
@@ -81,10 +84,9 @@ class views_handler_relationship extends views_handler {
|
||||
}
|
||||
|
||||
/**
|
||||
* Default options form that provides the label widget that all fields
|
||||
* should have.
|
||||
* Provide the label widget that all fields should have.
|
||||
*/
|
||||
function options_form(&$form, &$form_state) {
|
||||
public function options_form(&$form, &$form_state) {
|
||||
parent::options_form($form, $form_state);
|
||||
$form['label'] = array(
|
||||
'#type' => 'textfield',
|
||||
@@ -105,7 +107,7 @@ class views_handler_relationship extends views_handler {
|
||||
/**
|
||||
* Called to implement a relationship in a query.
|
||||
*/
|
||||
function query() {
|
||||
public function query() {
|
||||
// Figure out what base table this relationship brings to the party.
|
||||
$table_data = views_fetch_data($this->definition['base']);
|
||||
$base_field = empty($this->definition['base field']) ? $table_data['table']['base']['field'] : $this->definition['base field'];
|
||||
@@ -126,7 +128,7 @@ class views_handler_relationship extends views_handler {
|
||||
}
|
||||
|
||||
if (!empty($def['join_handler']) && class_exists($def['join_handler'])) {
|
||||
$join = new $def['join_handler'];
|
||||
$join = new $def['join_handler']();
|
||||
}
|
||||
else {
|
||||
$join = new views_join();
|
||||
@@ -137,7 +139,7 @@ class views_handler_relationship extends views_handler {
|
||||
$join->construct();
|
||||
$join->adjusted = TRUE;
|
||||
|
||||
// use a short alias for this:
|
||||
// Use a short alias for this.
|
||||
$alias = $def['table'] . '_' . $this->table;
|
||||
|
||||
$this->alias = $this->query->add_relationship($alias, $join, $this->definition['base'], $this->relationship);
|
||||
@@ -152,9 +154,10 @@ class views_handler_relationship extends views_handler {
|
||||
/**
|
||||
* You can't groupby a relationship.
|
||||
*/
|
||||
function use_group_by() {
|
||||
public function use_group_by() {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -163,22 +166,44 @@ class views_handler_relationship extends views_handler {
|
||||
* @ingroup views_relationship_handlers
|
||||
*/
|
||||
class views_handler_relationship_broken extends views_handler_relationship {
|
||||
function ui_name($short = FALSE) {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function ui_name($short = FALSE) {
|
||||
return t('Broken/missing handler');
|
||||
}
|
||||
|
||||
function ensure_my_table() { /* No table to ensure! */ }
|
||||
function query() { /* No query to run */ }
|
||||
function options_form(&$form, &$form_state) {
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function ensure_my_table() {
|
||||
// No table to ensure!
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function query() {
|
||||
// No query to run.
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function options_form(&$form, &$form_state) {
|
||||
$form['markup'] = array(
|
||||
'#markup' => '<div class="form-item description">' . t('The handler for this item is broken or missing and cannot be used. If a module provided the handler and was disabled, re-enabling the module may restore it. Otherwise, you should probably delete this item.') . '</div>',
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the handler is considered 'broken'
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
function broken() { return TRUE; }
|
||||
public function broken() {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user