Server IP : 172.67.216.182 / Your IP : 172.68.164.24 Web Server : Apache System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /www/wwwroot/lapma.in/wp-content/plugins/advanced-custom-fields/includes/Blocks/ |
Upload File : |
<?php /** * ACF Block Bindings * * @since 6.2.8 * @package ACF */ namespace ACF\Blocks; /** * The core ACF Blocks binding class. */ class Bindings { /** * Block Bindings constructor. */ public function __construct() { // Final check we're on WP 6.5 or newer. if ( ! function_exists( 'register_block_bindings_source' ) ) { return; } add_action( 'acf/init', array( $this, 'register_binding_sources' ) ); } /** * Hooked to acf/init, register our binding sources. */ public function register_binding_sources() { if ( acf_get_setting( 'enable_block_bindings' ) ) { register_block_bindings_source( 'acf/field', array( 'label' => _x( 'ACF Fields', 'The core ACF block binding source name for fields on the current page', 'acf' ), 'get_value_callback' => array( $this, 'get_value' ), ) ); } } /** * Handle returing the block binding value for an ACF meta value. * * @since 6.2.8 * * @param array $source_attrs An array of the source attributes requested. * @param \WP_Block $block_instance The block instance. * @param string $attribute_name The block's bound attribute name. * @return string The block binding value. */ public function get_value( array $source_attrs, \WP_Block $block_instance, string $attribute_name ) { if ( ! isset( $source_attrs['key'] ) || ! is_string( $source_attrs['key'] ) ) { $value = null; } else { $value = get_field( $source_attrs['key'] ); if ( is_array( $value ) ) { $value = implode( ', ', $value ); } // If we're not a scalar we'd throw an error, so return early for safety. if ( ! is_scalar( $value ) ) { $value = null; } } return apply_filters( 'acf/blocks/binding_value', $value, $source_attrs, $block_instance, $attribute_name ); } }