public function ItemListElement::form in Schema.org Metatag 8.2
Create a complete form element for this property type.
Parameters
array $input_values: An array of values to be passed to the form creator, including:
- @var string 'title' The title to use for the form element.
- @var string 'description' The description to use for the form element.
- @var array 'value' The current value of the form element.
- @var string 'visibility_selector' The selector to use in assessing form element visibility, usually the @type element.
- @var array 'tree_parent' The top level to use for @type, defaults to ''.
- @var int 'tree_depth' The depth to go in the tree hierarchy, defaults to -1.
- @var string 'multiple' Whether multiple values should be allowed, defaults to FALSE.
Return value
array Return a form array.
Overrides PropertyTypeBase::form
1 method overrides ItemListElement::form()
- BreadcrumbList::form in src/
Plugin/ schema_metatag/ PropertyType/ BreadcrumbList.php - Create a complete form element for this property type.
File
- src/
Plugin/ schema_metatag/ PropertyType/ ItemListElement.php, line 29
Class
- ItemListElement
- Provides a plugin for the 'ItemListElement' Schema.org property type.
Namespace
Drupal\schema_metatag\Plugin\schema_metatag\PropertyTypeCode
public function form($input_values) {
$value = $input_values['value'];
$form = [
'#type' => 'textfield',
'#title' => $input_values['title'],
'#description' => $input_values['description'],
'#default_value' => !empty($value) ? $value : '',
'#maxlength' => 255,
];
$form['#description'] = $this
->t('To create a list, provide a token for a multiple value field, or a comma-separated list of values.');
$form['#description'] .= $this
->t("OR Provide the machine name of the view, and the machine name of the display, separated by a colon, i.e. 'view_name:display_id'. This will create a <a href=':url'>Summary View</a> list, which assumes each list item contains the url to a view page for the entity. The view rows should contain content (like teaser views) rather than fields for this to work correctly.", [
':url' => 'https://developers.google.com/search/docs/guides/mark-up-listings',
]);
return $form;
}