Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function calculateDependencies()
 {
     $dependencies = parent::calculateDependencies();
     $vocabulary = $this->vocabularyStorage->load($this->options['vid']);
     $dependencies[$vocabulary->getConfigDependencyKey()][] = $vocabulary->getConfigDependencyName();
     foreach ($this->options['value'] as $tid) {
         $term = $this->termStorage->load($tid);
         $dependencies[$term->getConfigDependencyKey()][] = $term->getConfigDependencyName();
     }
     return $dependencies;
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function buildForm(array $form, FormStateInterface $form_state, VocabularyInterface $taxonomy_vocabulary = NULL, $selected_terms = array())
 {
     if (empty($selected_terms)) {
         $form['info'] = array('#markup' => $this->t('Please select the terms you want to export.'));
         return $form;
     }
     // Cache form state so that we keep the parents in the modal dialog.
     $form_state->setCached(TRUE);
     $form['voc'] = array('#type' => 'value', '#value' => $taxonomy_vocabulary);
     $form['selected_terms']['#tree'] = TRUE;
     $items = array();
     foreach ($selected_terms as $t) {
         $term = $this->termStorage->load($t);
         $items[] = $term->getName();
         $form['selected_terms'][$t] = array('#type' => 'value', '#value' => $t);
     }
     $form['terms'] = array('#theme' => 'item_list', '#items' => $items, '#title' => $this->t('Selected terms for export:'));
     $form['download_csv'] = array('#type' => 'submit', '#value' => $this->t('Download CSV'));
     $form['export'] = array('#type' => 'submit', '#value' => $this->t('Export'));
     return $form;
 }
Ejemplo n.º 3
0
 public function buildForm(array $form, FormStateInterface $form_state, VocabularyInterface $taxonomy_vocabulary = NULL, $selected_terms = array())
 {
     if (empty($selected_terms)) {
         $form['info'] = array('#markup' => $this->t('Please select the terms you want to move.'));
         return $form;
     }
     // Cache form state so that we keep the parents in the modal dialog.
     $form_state->setCached(TRUE);
     $form['voc'] = array('#type' => 'value', '#value' => $taxonomy_vocabulary);
     $form['selected_terms']['#tree'] = TRUE;
     $items = array();
     foreach ($selected_terms as $t) {
         $term = $this->termStorage->load($t);
         $items[] = $term->getName();
         $form['selected_terms'][$t] = array('#type' => 'value', '#value' => $t);
     }
     $form['terms'] = array('#theme' => 'item_list', '#items' => $items, '#title' => $this->t('Selected terms to move:'));
     // @todo Add autocomplete to select/add parent term.
     $form['keep_old_parents'] = array('#type' => 'checkbox', '#title' => $this->t('Keep old parents and add new ones (multi-parent). Otherwise old parents get replaced.'));
     $form['delete'] = array('#type' => 'submit', '#value' => $this->t('Move'));
     return $form;
 }