diff --git a/administrator/components/com_content/config.xml b/administrator/components/com_content/config.xml index f32a9e945b5e0..4d9a92d4bb7c6 100644 --- a/administrator/components/com_content/config.xml +++ b/administrator/components/com_content/config.xml @@ -1050,6 +1050,27 @@ + + + + + + + + +
get('custom_fields_enable', 1)) + { + return; + } + + $customFieldsEnabledContexts = $compParams->get('custom_fields_enabled_contexts', ''); + + if (is_array($customFieldsEnabledContexts)) + { + if (in_array($parts[0] . '.' . $parts[1], $customFieldsEnabledContexts)) + { + $context = $compParams->get('custom_fields_base_context', $context); + $parts = FieldsHelper::extract($context); + } + else + { + // We have no contexts within which to show custom fields + return; + } + } + } + if (is_string($params) || !$params) { $params = new Registry($params); @@ -446,6 +473,33 @@ public function onContentPrepare($context, $item) return; } + if (strpos($parts[0], 'com_') === 0) + { + $compParams = JComponentHelper::getParams($parts[0]); + + // Should check if we want the custom fields displayed + if (!$compParams->get('custom_fields_enable', 1)) + { + return; + } + + $customFieldsEnabledContexts = $compParams->get('custom_fields_enabled_contexts', ''); + + if (is_array($customFieldsEnabledContexts)) + { + if (in_array($parts[0] . '.' . $parts[1], $customFieldsEnabledContexts)) + { + $context = $compParams->get('custom_fields_base_context', $context); + $parts = FieldsHelper::extract($context); + } + else + { + // We have no contexts within which to show custom fields + return; + } + } + } + $fields = FieldsHelper::getFields($parts[0] . '.' . $parts[1], $item, true); // Adding the fields to the object