Type.php in Schema.org Metatag 8.2
File
src/Plugin/schema_metatag/PropertyType/Type.php
View source
<?php
namespace Drupal\schema_metatag\Plugin\schema_metatag\PropertyType;
use Drupal\schema_metatag\Plugin\schema_metatag\PropertyTypeBase;
class Type extends PropertyTypeBase {
public function formElement(array $input_values) {
$options = $this
->getOptionList($input_values['tree_parent'], $input_values['tree_depth']);
$value = $input_values['value'];
$form['#type'] = 'select';
$form['#title'] = $input_values['title'];
$form['#description'] = $input_values['description'];
$form['#default_value'] = !empty($value) ? $value : '';
$form['#empty_option'] = ' - ' . $this
->t('Select') . ' - ';
$form['#empty_value'] = '';
$form['#options'] = $options;
return $form;
}
public function testValue($type = 'Organization') {
return is_array($type) ? array_shift($type) : $type;
}
}
Classes
Name |
Description |
Type |
Provides a plugin for the '@type' Schema.org property type. |