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
2 changes: 1 addition & 1 deletion includes/class.field_type.php
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ public function process_placeholders( $str, $layout = 'form', $data = null ) {
// Iterate through instances of current placeholder
foreach ( $instances as $instance ) {
// Process value based on placeholder name.
$target_property = $this->util->apply_filters_ref_array( "process_placeholder_${tag}", [ '', $this, &$instance, $layout, $data ], false );
$target_property = $this->util->apply_filters_ref_array( "process_placeholder_{$tag}", [ '', $this, &$instance, $layout, $data ], false );
// Process value using default processors (if necessary).
if ( '' === $target_property ) {
$target_property = $this->util->apply_filters_ref_array( 'process_placeholder', [ $target_property, $this, &$instance, $layout, $data ], false );
Expand Down
2 changes: 1 addition & 1 deletion includes/class.options.php
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ function get_key() {
function &add( $id, $properties = array(), $update = false ) {
// Create item
$args = func_get_args();
$ret = call_user_func_array( array( 'parent', 'add' ), $args );

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I resolved this with this code:

$ret = parent::add(...func_get_args());

I was coming to see if it was implemented.. but I guess both ways work. Cheers!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, both seem to work. I don't mind updating my PR to that style.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@archetyped do you have a preference, and are you interested in merging this PR?

Copy link

@digitaldonkey digitaldonkey Apr 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can confirm this being helpful.

But My IDE wants me to change Return type too:

	/**
	 * Add option to collection
	 * @uses SLB_Field_Collection::add() to add item
	 * @param string $id Unique item ID
	 * @param array $properties Item properties
	 * @param bool $update (optional) Should item be updated or overwritten (Default: FALSE)
	 * @return false|object|SLB_Field Option instance
	 */
	function &add( $id, $properties = array(), $update = false ) {
		// Create item
        $ret = parent::add(...func_get_args());
		return $ret;
	}

$ret = call_user_func_array( array( parent::class, 'add' ), $args );
return $ret;
}

Expand Down
2 changes: 2 additions & 0 deletions includes/class.utilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,9 @@ public function validate_client_object( $obj, $cmd = null ) {

// Build condition
$sep = '.';
$obj = $obj ? $obj : '';
$obj = trim( $obj, $sep );

// Strip base object
if ( 0 === strpos( $obj, $base . $sep ) ) {
$obj = substr( $obj, strlen( $base . $sep ) );
Expand Down