Home Forums Backend Issues (wp-admin) Modify Field Settings Form


Modify Field Settings Form

  • I can’t find any info on how I can modify the field settings in the back end of ACF for every field.

    I want to add my own options to all fields when building a form.

    Thanks for any help.

  • You want to add additional options that appear when someone is entering information on a post or some other place, or additional values when created a field? There isn’t really any way to alter the built in field types without modifying the ACF code. What you’d have to do is build custom field types

  • There’s not an array I can parse or something?

    Basically I want to add an option to all fields for “READ-ONLY” and an option to process shortcodes for the default.

  • Yes, that you can do, I thought you wanted to add more settings. Fields already have a readonly property, it’s just not editable when creating fields. You can set the value of this property using an acf/load_field filter

    In the filter if you do

    echo '<pre>'; print_r($field); echo '</pre>';

    all of the field’s settings will be listed. Any value of the field can be edited at this point with a few exceptions like the field name, field key, field type. There may be others that you shouldn’t change, I don’t know them all off the top of my head.

    If you want to process shortcodes for a field or run some other functions on the value of the field then you use the acf/format_value filter, an example of running shortcodes for all textarea fields is given on that page.

    a note here, you can also use the $field_name and $field_key hooks in ACF5, these are not documented.

  • I have filters that set READ-ONLY and handle shortcodes, but I have to write code every time I want to do it. I’d rather I could just set it in the interface, which is why I want to modify the interface.

    I have stuff I want to release to other stations our company owns and they don’t have programmers.

    And I am completely baffled as to why this has NEVER been implemented, even though I’ve found dozens of requests for it.

  • I don’t know why it has not been implemented. It could be that the list of things that needs to be done outweighs the list of things that people would like to be done. For example the need for ACF to start using term meta because WorPress has now implemented it, I’m sure that this has a higher priority than adding a read only option to all of the field types. The ACF code is built and maintained by a single person. The fields work the way they are and with filters they can be altered to allow for things that most people don’t need. If something needs to be done and used on multiple site then a plugin could be built with the fields and filters that are needed to make it work.

    As far a readonly being a setting in all fields but not in the interface, I’m guessing it’s because ACF uses readonly fields somewhere and ACF uses the same code for displaying the fields in it’s interface that’s used for displaying the fields we create. Another example of something that exists mainly because ACF uses it is the radio field with the add other value capability. This functionality is used on the date picker field and if not for the existence of the date picker field I doubt that is would be in ACF at all. There have been many requests for select and check box fields with this functionality and I know it’s o the to-do list, but other things are getting priority.

    I’m not trying to make excuses, and I’m not involved with the actually development of this plugin, but being a developer myself that often needs to weigh and prioritize what I do, I can see why some things don’t get the attention that people may think they should.

    To be honest, I’m glad that it’s possible to make changes because Elliot put in plenty of hooks to work with. There are a lot of plugins that don’t have the hooks that allow it. To customize the interface we have 2 choices, we can use the hooks that have been provided or we can can create new field types that add the extra features to the interface that we want.

    At this point, the only choice you have other than using the hooks that are available and creating filters would be to hack ACF to add features to existing fields.

  • Thanks, more hooks into ACF so that we could modify the default interface would relieve a lot of work for him…

  • Two undocumented hooks, not documented as in not in the site.

    One of the is called when rendering field settings. this is the function in specific field types that outputs the field inputs when you’re creating a field group acf/render_field/type={$field_type_name}. It displayes inputs that are not part of every field type. For an idea of what you would do in this filter look at the render_field() function in any of the field types. If you added a filter on this hook with a priority of < 10 it would add field settings before the field specific settings, using a priority > 10 would output them after.

    The second hook is acf/render_field_settings/type={$field_type_name}. This is the hook that’s called when the inputs the user sees on a post or other location is called. You can see what you would do in this filter by looking at the render_field_settings() function in any field of the field type files.

    I don’t see any way to set defaults for any field settings you might choose to add though, these are set when the class in instantiated and there’s no way to hook into that.

    There isn’t any way to override what the build in functions do but you can add to what they do either before or after they do it. I’m not sure using them in the way might cause any unintended side effects.

Viewing 8 posts - 1 through 8 (of 8 total)

The topic ‘Modify Field Settings Form’ is closed to new replies.