Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,16 @@
"yoast/phpunit-polyfills": "^2.0.5",
"tangible/framework": "dev-main"
},
"require": {},
"require": {
"symfony/yaml": "^7.0"
},
"autoload": {
"psr-4": {
"Tangible\\": "./src"
}
},
"files": [
"src/Settings/index.php"
]
},
"autoload-dev": {
"psr-4": {
Expand Down
237 changes: 234 additions & 3 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions plugin.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
/**
* Plugin Name: Tangible Object
* Description:
* Version: 0.0.1
* Description: A WordPress tool suite for building data-driven interfaces with a clean extensible architecture.
* Version: 0.0.2
* GitHub URI: TangibleInc/object
*/

Expand Down
16 changes: 14 additions & 2 deletions src/DataView/RequestRouter.php
Original file line number Diff line number Diff line change
Expand Up @@ -423,16 +423,27 @@ protected function handle_settings_submit(): void {
/**
* Extract and sanitize POST data based on field types.
*
* In singular mode, the SettingsRenderer nests field names under the
* settings key (e.g., `settings_slug[field_name]`), so POST data arrives
* as `$_POST['settings_slug']['field_name']`. We check the nested array
* first, then fall back to flat `$_POST['field_name']` for compatibility.
*
* @return array Sanitized data.
*/
protected function extract_post_data(): array {
$data = [];

// phpcs:ignore WordPress.Security.NonceVerification.Missing
$nested = $_POST[ $this->config->slug ] ?? [];

foreach ( $this->config->field_configs as $name => $config ) {
$type = $config['type'];

// Check nested array first (singular/settings mode), then flat POST
// phpcs:ignore WordPress.Security.NonceVerification.Missing
if ( ! isset( $_POST[ $name ] ) ) {
$has_value = isset( $nested[ $name ] ) || isset( $_POST[ $name ] );

if ( ! $has_value ) {
// Handle missing boolean fields (unchecked checkboxes).
if ( $this->registry->get_dataset_type( $type ) === DataSet::TYPE_BOOLEAN ) {
$data[ $name ] = false;
Expand All @@ -446,7 +457,8 @@ protected function extract_post_data(): array {

$sanitizer = $this->registry->get_sanitizer( $type );
// phpcs:ignore WordPress.Security.NonceVerification.Missing
$data[ $name ] = $sanitizer( $_POST[ $name ] );
$raw_value = $nested[ $name ] ?? $_POST[ $name ];
$data[ $name ] = $sanitizer( $raw_value );
}

return $data;
Expand Down
Loading
Loading