getArguments(); if (! key_exists('a-pro', $arguments)) { continue; } if (! key_exists('label', $arguments)) { $arguments['label'] = ''; } if (! key_exists('instructions', $arguments)) { $arguments['instructions'] = ''; } $type = $arguments['a-type'] ?? ''; if ('tab' === $type) { $fieldInfo->setArgument('label', $arguments['label'] . ' (PRO)'); } else { $fieldInfo->setArgument( 'instructions', sprintf( 'Upgrade to PRO to unlock. %s', Plugin::PRO_VERSION_URL, $arguments['instructions'] ) ); } } return $fieldsInfo; } /** * @param FieldInfoInterface[] $fieldsInfo * * @return array */ protected static function updateAcfProFields(array $fieldsInfo): array { foreach ($fieldsInfo as $fieldInfo) { $arguments = $fieldInfo->getArguments(); if (! key_exists('a-acf-pro', $arguments)) { continue; } if (! key_exists('label', $arguments)) { $arguments['label'] = ''; } if (! key_exists('instructions', $arguments)) { $arguments['instructions'] = ''; } $fieldInfo->setArgument( 'instructions', sprintf( '(ACF PRO version is required for this feature) %s', 'https://www.advancedcustomfields.com/pro/', $arguments['instructions'] ) ); } return $fieldsInfo; } public static function getFieldsInfo(): array { $fieldsInfo = parent::getFieldsInfo(); if (! defined('ACF_VIEWS_PRO')) { $fieldsInfo = static::updateProFields($fieldsInfo); } // placed secondary, as notice about ACF PRO should be added before ACF Views PRO (later = upper) if (! Plugin::isAcfProPluginAvailable()) { $fieldsInfo = static::updateAcfProFields($fieldsInfo); } return $fieldsInfo; } }