Half of these could be methods on HandlerBase, the rest could be in views.module

  • views_get_table_join()
  • views_break_phrase_string()
  • views_break_phrase()
  • views_get_timezone()
  • views_date_sql_field()
  • views_date_sql_format()
  • views_date_sql_extract()
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner’s picture

Couldn't we move things to the HandlerBase if possible but still keep the functions in handlers.inc as we will not need this file on every page load?

tim.plunkett’s picture

Status: Active » Needs review
FileSize
44.16 KB

Let's see what happens!

Status: Needs review » Needs work

The last submitted patch, views-1792800-1.patch, failed testing.

tim.plunkett’s picture

Status: Needs work » Needs review
FileSize
44.16 KB

I was able to avoid moving anything into views.module, yay.

dawehner’s picture

+++ b/lib/Drupal/views/Plugin/views/HandlerBase.phpundefined
@@ -618,4 +621,317 @@ public function validate() { return array(); }
+  public function getSQLFormat($format) {
...
+  public function getSQLDateField() {

Why not making a static function?

+++ b/lib/Drupal/views/Plugin/views/HandlerBase.phpundefined
@@ -618,4 +621,317 @@ public function validate() { return array(); }
+    $offset = $this->getTimezone();

Can you actually call a static function like that?

tim.plunkett’s picture

FileSize
44.47 KB

It's not static, it calls $this inside of it.

Yes you can! :)

I did mess up one of the other statics though.

tim.plunkett’s picture

FileSize
44.48 KB

Oh, I missed another thing.

tim.plunkett’s picture

Assigned: tim.plunkett » Unassigned
tim.plunkett’s picture

aspilicious’s picture

+++ b/lib/Drupal/views/Plugin/views/HandlerBase.phpundefined
@@ -618,4 +621,317 @@ public function validate() { return array(); }
+   * Helper function to create cross-database SQL date formatting.

See my helper function remark

+++ b/lib/Drupal/views/Plugin/views/HandlerBase.phpundefined
@@ -618,4 +621,317 @@ public function validate() { return array(); }
+   * Helper function to create cross-database SQL dates.

Always start with a verb even if it's a helper function.

+++ b/lib/Drupal/views/Plugin/views/HandlerBase.phpundefined
@@ -618,4 +621,317 @@ public function validate() { return array(); }
+   *   will be used, i.e. $set_offset = 0 will make no timezone adjustment.
+   * @return
+   *   An appropriate SQL string for the db type and field type.

Newline before return

+++ b/lib/Drupal/views/Plugin/views/HandlerBase.phpundefined
@@ -618,4 +621,317 @@ public function validate() { return array(); }
+    if (!$handler) {
+      $handler = new \stdClass();

Makes me sad :(. This needs to die, we need an empty HandlerBase thingie

Some minor stuff

tim.plunkett’s picture

FileSize
44.04 KB
1.28 KB

Fixed the first 3, opened the issue for the 4th.

aspilicious’s picture

Status: Needs review » Needs work
+++ b/lib/Drupal/views/Plugin/views/argument/Date.phpundefined
@@ -83,4 +83,63 @@ function get_sort_name() {
+   * Helper function to create cross-database SQL date extraction.

Srry missed that one

tim.plunkett’s picture

Status: Needs work » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.