join('farm_sensor', 'fs', 'fa.id = fs.id'); // Limit by the sensor type. if (isset($this->configuration['sensor_type'])) { // Specify the sensor type. if (!empty($this->configuration['sensor_type'])) { $query->condition('fs.type', (array) $this->configuration['sensor_type'], 'IN'); } // Allow empty sensor type. else { $query->where("fs.type = '' OR fs.type IS NULL"); } } // Add sensor fields aliased with correct name. $query->addField('fs', 'type', 'sensor_type'); $query->addField('fs', 'settings', 'sensor_settings'); return $query; } /** * {@inheritdoc} */ public function prepareRow(Row $row) { // Get the sensor_settings field. $settings = $row->getSourceProperty('sensor_settings'); if (!empty($settings)) { // Unserialize the sensor_settings field. $settings_array = unserialize($settings, ['allowed_classes' => FALSE]); // Re-set the source property value. $row->setSourceProperty('sensor_settings', $settings_array); } return parent::prepareRow($row); } }