Advanced Link
ACF Extended
Last Upated: Wednesday, Jan 31, 2024
acfe_advanced_link
The Advanced Link is a custom ACF Field Type made available by the Advanced Custom Fields Extended plugin.
Field Settings
Field Configuration
<?phpadd_action( 'acf/include_fields', function() { if ( ! function_exists( 'acf_add_local_field_group' ) ) { return; } acf_add_local_field_group( [ { "key": "my_field_group_", "title": "My Field Group with acfe_advanced_link", "show_in_graphql": 1, "graphql_field_name": "myFieldGroupWithAcfeAdvancedLink", "map_graphql_types_from_location_rules": 0, "graphql_types": [ "Page" ], "fields": [ { "key": "my_field_", "label": "My Field", "name": "my_field", "type": "acfe_advanced_link", "show_in_graphql": 1, "graphql_field_name": "myFieldWithAcfeAdvancedLink" } ], "location": [ [ { "param": "post_type", "operator": "==", "value": "page" } ] ] } ] );});
Types Added to the Schema
To support the Advanced Link field type in the GraphQL Schema, additional GraphQL Object Types and Interfaces are added to the Schema:
- ACFE_AdvancedLink (interface): The interface implemented by the possible types an Advanced Link could return
- ACFE_AdvancedLink_Url (object type): The Object Type resolved if the advanced link field links to a URL
- ACFE_AdvancedLink_TermNode (object type): The Object Type resolved if the advanced link field links to a term.
- ACFE_AdvancedLink_ContentNode (object type): The Object Type resolved if the advanced link field links to a Content Node (post).
Resolve Type
Fields of the "acfe_advanced_link" resolve to the "ACFE_AdvancedLink" Interface type.
This means that when querying for an advanced link field, the response will be one of the possible types that implement the ACFE_AdvancedLink interface (ACFE_AdvancedLink_Url, ACFE_AdvancedLink_TermNode, ACFE_AdvancedLink_ContentNode).