/** * Implements TMGMTSourceUIControllerInterface::overviewForm(). */ public function overviewForm(array $form, FormStateInterface $form_state, $type) { $form = parent::overviewForm($form, $form_state, $type); $search_data = $this->getSearchFormSubmittedParams(); $form['items']['#empty'] = $this->t('No strings matching given criteria have been found.'); $strings = $this->getStrings($search_data['label'], $search_data['missing_target_language']); foreach ($this->getTranslationData($strings, $type) as $id => $data) { $form['items']['#options'][$id] = $this->overviewRow($type, $data); } $form['pager'] = array('#type' => 'pager'); return $form; }
/** * {@inheritdoc} */ public function overviewForm(array $form, FormStateInterface $form_state, $type) { $form = parent::overviewForm($form, $form_state, $type); // Load search property params which will be passed into $search_property_params = array(); $exclude_params = array('q', 'page'); foreach (\Drupal::request()->query->all() as $key => $value) { // Skip exclude params, and those that have empty values, as these would // make it into query condition instead of being ignored. if (in_array($key, $exclude_params) || $value === '') { continue; } $search_property_params[$key] = $value; } // If the source is of type '_simple_config', we get all definitions that // don't have an entity type and display them through overviewRowSimple(). if ($type == ConfigSource::SIMPLE_CONFIG) { $definitions = $this->getFilteredSimpleConfigDefinitions($search_property_params); foreach ($definitions as $definition_id => $definition) { $form['items']['#options'][$definition_id] = $this->overviewRowSimple($definition); } } else { foreach ($this->getTranslatableEntities($type, $search_property_params) as $entity) { $form['items']['#options'][$entity->getConfigDependencyName()] = $this->overviewRow($entity); } } return $form; }
/** * {@inheritdoc} */ public function overviewForm(array $form, FormStateInterface $form_state, $type) { $form = parent::overviewForm($form, $form_state, $type); // Build a list of allowed search conditions and get their values from the request. $entity_type = \Drupal::entityManager()->getDefinition($type); $whitelist = array('langcode', 'target_language', 'target_status'); if ($entity_type->hasKey('bundle')) { $whitelist[] = $entity_type->getKey('bundle'); } if ($entity_type->hasKey('label')) { $whitelist[] = $entity_type->getKey('label'); } $search_property_params = array_filter(\Drupal::request()->query->all()); $search_property_params = array_intersect_key($search_property_params, array_flip($whitelist)); $bundles = $this->getTranslatableBundles($type); foreach (self::getTranslatableEntities($type, $search_property_params, TRUE) as $entity) { // This occurs on user entity type. if ($entity->id()) { $form['items']['#options'][$entity->id()] = $this->overviewRow($entity, $bundles); } } $form['pager'] = array('#type' => 'pager'); return $form; }