Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(array $form, FormStateInterface $form_state)
 {
     $export_types = $this->config('rdf_export.settings')->get('export_types');
     // @todo: Check which format are supported by the server?
     $formats = Format::getFormats();
     $list = [];
     /** @var \EasyRdf\Format $format */
     foreach ($formats as $format) {
         if ($format->getSerialiserClass()) {
             $list[$format->getName()] = $format->getLabel();
         }
     }
     $form['export_types'] = array('#type' => 'select', '#title' => t('Export types'), '#options' => $list, '#multiple' => TRUE, '#default_value' => empty($export_types) ? [] : $export_types, '#description' => t('Select the export types for rdf entities.'));
     return parent::buildForm($form, $form_state);
 }
Exemplo n.º 2
0
 /**
  * Builds a list of supported serialization formats.
  */
 protected function getSerializerFormats()
 {
     // Many more are supported...
     // @todo Move this to a settings form.
     $white_list = $this->config('rdf_export.settings')->get('export_types');
     $list = [];
     $formats = Format::getFormats();
     /** @var \EasyRdf\Format $format */
     foreach ($formats as $format) {
         if (!in_array($format->getName(), $white_list)) {
             continue;
         }
         if ($format->getSerialiserClass()) {
             $list[$format->getName()] = $format;
         }
     }
     return $list;
 }