I'm a little confused about this, even though I have read all of the API and searched for hours.
When I activate my plugin I add some values to the options database, e.g.
add_option('code','24');
How do I update that value or use it in the widget? I only see "instances" now, like the example on this page:
http://wpcoderz.com/creating-a-multi-instance-widget-with-wordpress-2-8/
You can get an option using get_option and update it using update_option. But you should use instances instead of options for widget settings (like title) because that's the purpose of instances. You don't have to care about storing instance value - WP does it for you. If you don't understand instances well, look at codex.wordpress.org/Widgets_API.
Related
I know how to use input widget in Slate but I have a use case where I need to create several inputs from an array. Maybe one, maybe more, let's say around 10 or 15. Is that possible to create a input and to catch the user entry just by using an HTML widget.
One other way to say shoud be: I would like to have a table of 1 to 15 rows with one column dedicated to an input area. Number of row depend of the source data, so I want that the input is created dynamically. Is it possible in foundry-slate ?
Best regards
You can't do this in a plain HTML widget - the dependency graph can't read state from arbitrary HTML input elements.
There are a couple other options here; the one that most directly works they way you would like it to in your question, would be to use the Code Sandbox widget, which effectively let's you build your own widget and wire it up to the Slate dependency graph for interaction with the rest of the app. You can use a 3rd-party library, assuming you have the license, to do something more advanced (you can search your Foundry instance for some examples in the Slate Reference Examples) or simply use HTML and Javascript to build the widget as you would in normal web development as you have access to the DOM and JQuery when working in the Sandbox.
Slightly more in-line with how Slate might expect you to build this functionality, you can use a single input widget, but toggle what you do with the associated input based on other state, for example what row the user has selected. This, in combination with a button that stores the input into a Variable with a click event, can be used to let users build up a "bag" of edits, that you can then apply with Actions (or you can apply them immediately - all depends on the workflow). You'll find some examples of that pattern in the "Events" folder in the Slate Reference Examples.
Thinking a bit more expansively, if you model your data in the ontology, you can set up an editable table pattern in Workshop and have a quite straightforward experience once you have the right Action and Object Type configuration. You'll find the documentation on this on your Foundry instance at https://www.palantir.com/docs/foundry/workshop/widgets-object-table/#inline-edits-or-cell-level-writeback and an example in the Flight Alert Inbox example application.
I've been looking for a way to directly access a widget from my SonarQube instance with a direct URL, the way it's possible to access a Dashboard. Is it possible to do that adding the respective metrics from the configuration of the Widget? The problem I found is that I can only "build" a widget and it takes the filter parameter, sizes, but when it comes to the metrics, they are ignored and it builds it with the default ones for the respective widget.
I have the following Widget configured (with metrics: Classes, Comment_Density and size - Complexity):
When building the URL to get directly this widget, I found it impossible to access it by its Id. So, I added all configuration details, but the widget I get is this, holding the default metrics - Lines of Code, Issues and Technical Debt. Built widget:
Is accessing directly a configured Widget even possible with the current versions of the SonarQube?
The URL I used is :
<sonarqubeinstance>/widget?id=measure_filter_bubble_chart&filter=1&chartTitle=Measure%20Bubble%20Chart&chartHeight=400&widget_width=1279px&metric1=classes&metric2=comment_lines_density&metric3=complexity
Thanks in advance for your help!
What you try to achieve is not possible.
What's more, keep in mind that those widgets do not exist any more starting with SonarQube 6.2. And there is no plan to reintroduce them.
I am working with Advanced custom fields, where I add an image selector for categories in wp - But I can't see the data in my JSON response for categories?
I have tried to use several plugins to do the same, but That haven't worked either -
I am using ACF to rest plugin to include acf fields in the response, which works fine on custom post types - where it creates an array field called "acf"
This field is not created in my categories though - Am i missing a function to use it in taxonomies?
examples.
domain.com/wp-json/wp/v2/recipies (a custom post type)
returns everything including acf.
domain.com/wp-json/v2/categories (a texonomy)
returns all of the categories, but nothing about acf
domain.com/wp-json/wp/v2/categories/37 (a single category)
returns the category but nothing about acf.
domain.com/wp-json/wp/v2/categories/37?_embed[0] (way of getting all embedded stuff)
Does not show acf
Hope that you can put me on the right path.
To anybody who is interested, and runs into this problem.
I talked to the developer of acf-to-rest, and there is a bug in version 2, where it doesn't save taxonomies correctly - It is fixed in version 3, but you can't update it yet through wordpress, since it is still in beta -
Redownload the plugin and go into your wp-config file
here you need to define that you are going to use version 3. paste this line into the wp-config file
define('ACF_TO_REST_API_REQUEST_VERSION', 3);
The endpoints has been rewritten, so you also need to read up on that if you are using the acf endpoints for updating etc.
To read more about the bug, go github page
To read about the end points - go here
I hope that this will help somebody in the future.
How can i add custom fields to course detail? just like user. Is there any plugin to do? I tried moodle-course_meta.And i can add additional fields to course,but when i try to use in upload course with and without adding profile_field_ as prefix,It doesn't take the value from the csv file.
Eg. i created custom field for a course using the plugin and call it note
And upload csv file which has field name note and also tried like what we do on user profile_field_note. On both no luck. but the rest course fields such as shortname,fullname... are imported properly.
I am on moodle version 2.8.3
There is no easy way to do it at the moment.
Some options are listed on tracker issue https://tracker.moodle.org/browse/MDL-34634
They include writing your own course format plugin or using the contributed local/admintool plugin, there are several links on this issue. The second option may be not properly compatible with backup/restore.
I would like to rename the default tab value of Taxonomy in the backend page editor. I didn't find anything in the twig or yml files that would address this. Any ideas?
I checked with bolt developers and there is no way currently to do this. One potential option was to use the messages file but it was not recommended.
As you can imagine, since this isn't supported via the public configs, this will need a bit more advanced plugging together.
Here is a way to add an additional resource to the stack of translations.
https://gist.github.com/rossriley/c74fdee4fec3eaffb12f
This is a technique to add your own messages onto the translation stack without touching the underlying core files.
After creating this, you'll need to add your new service provider to the app, which you normally will bootstrap either in your index.php or a custom bootstrap file.