0

I'm looking for the right method to modify an especific plugin views ui inside a custom module. The views plugin to alter is created by the module https://www.drupal.org/project/views_json_source I want to hide the "json file" field, in the query options. And when the view is executed i want prefill this field with config data from my custom module. Later i will need to create my custom exposed form using the json fields, but this is another story.

I think the right way is using the hook_views_plugin_option_definition_alter, but i've tested it in my module and it dont make nothing (drupal messages are not displayed).

The views json source have an plugin/views/query/ViewsJsonQuery with this code:

public function buildOptionsForm(&$form, FormStateInterface $form_state) {

  $form['json_file'] = [
    '#type' => 'textfield',
    '#title' => $this->t('JSON File'),
    '#default_value' => $this->options['json_file'],
    '#description' => $this->t("The URL or path to the JSON file."),
    '#maxlength' => 1024,
  ];

}

Somebody can help to the right way?

Thanks in advance.

PD.: I'm using Drupal 9.

0

Finally i've created an customized views_json_source module adapted to my requirement. Anyway, it would be interesting if somebody can ask the question.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.