: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* Maps PTB's "video" field type to "video" & "text" field in Builder
* @package Themify Builder Pro
* @link https://themify.me/
class Tbp_Dynamic_Item_PTBLinkButton extends Tbp_Dynamic_Item {
function is_available() {
return function_exists( 'run_ptb' );
function get_category() {
return array( 'text', 'textarea', 'wp_editor', 'url', 'video', 'audio' );
return __( 'PTB Custom Fields (Link Button)', 'tbp' );
function get_value( $args = array() ) {
if ( ! empty( $args['field'] ) ) {
$show = isset( $args['show'] ) && $args['show'] === 'title' ? 0 : 1;
$field_name = explode( ':', $args['field'] );
$cf_value = get_post_meta( get_the_ID(), "ptb_{$field_name[1]}", true );
if ( isset( $cf_value[ $show ] ) ) {
$value = $cf_value[ $show ];
/* collect "text" field types in all post types */
$ptb = PTB::$options->get_custom_post_types();
foreach ( $ptb as $post_type_key => $post_type ) {
if ( is_array( $post_type->meta_boxes ) ) {
foreach ( $post_type->meta_boxes as $key => $field ) {
if ( $field['type'] === 'link_button' ) {
$label = PTB_Utils::get_label( $post_type->plural_label );
$name = PTB_Utils::get_label( $field['name'] );
$options[ "{$post_type_key}:{$key}" ] = sprintf( '%s: %s', $label, $name );
'label' => __( 'Field', 'tbp' ),
'label' => __( 'Show', 'tbp' ),
'title' => __( 'Link Title', 'tbp' ),
'url' => __( 'Link URL', 'tbp' ),