Tablefield.php in TableField 8.2
File
src/Utility/Tablefield.php
View source
<?php
namespace Drupal\tablefield\Utility;
class Tablefield {
public static function rationalizeTable(array $tablefield) {
$tabledata = [];
if (!empty($tablefield)) {
$count_cols = $tablefield['rebuild']['count_cols'];
$count_rows = $tablefield['rebuild']['count_rows'];
unset($tablefield['rebuild']);
unset($tablefield['import']);
foreach ($tablefield as $key => $value) {
preg_match('/cell_(.*)_(.*)/', $key, $cell);
if ((int) $cell[1] < $count_rows && (int) $cell[2] < $count_cols) {
$tabledata[$cell[1]][$cell[2]] = $value;
}
}
}
return $tabledata;
}
}
Classes
Name |
Description |
Tablefield |
Provides helpers to use timers throughout a request. |