public function ViewsJsonQuery::buildOptionsForm in Views Json Source 1.x
Same name and namespace in other branches
- 8 src/Plugin/views/query/ViewsJsonQuery.php \Drupal\views_json_source\Plugin\views\query\ViewsJsonQuery::buildOptionsForm()
Options form.
Overrides PluginBase::buildOptionsForm
File
- src/
Plugin/ views/ query/ ViewsJsonQuery.php, line 384
Class
- ViewsJsonQuery
- Base query handler for views_json_source.
Namespace
Drupal\views_json_source\Plugin\views\queryCode
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,
];
$form['row_apath'] = [
'#type' => 'textfield',
'#title' => $this
->t('Row Apath'),
'#default_value' => $this->options['row_apath'],
'#description' => $this
->t("Apath to records.<br />Apath is just a simple array item find method. Ex:<br /><pre>['data' => \n\t['records' => \n\t\t[\n\t\t\t['firstname' => 'abc', 'lastname' => 'pqr'],\n\t\t\t['firstname' => 'xyz', 'lastname' => 'aaa']\n\t\t]\n\t]\n]</pre><br />You want 'records', so Apath could be set to 'data/records'. <br />Notice: Use '%' as wildcard to get the child contents - EG: '%/records', Also add the contextual filter to replace the wildcard('%') with 'data'."),
'#required' => TRUE,
];
$form['show_errors'] = [
'#type' => 'checkbox',
'#title' => $this
->t('Show Json errors'),
'#default_value' => $this->options['show_errors'],
'#description' => $this
->t('If there were any errors during Json parsing, display them. It is recommended to leave this on during development.'),
'#required' => FALSE,
];
}