You are here

class QuickNodeCloneNodeSettingsForm in Quick Node Clone 8

Module settings form.

Hierarchy

Expanded class hierarchy of QuickNodeCloneNodeSettingsForm

1 string reference to 'QuickNodeCloneNodeSettingsForm'
quick_node_clone.routing.yml in ./quick_node_clone.routing.yml
quick_node_clone.routing.yml

File

src/Form/QuickNodeCloneNodeSettingsForm.php, line 10

Namespace

Drupal\quick_node_clone\Form
View source
class QuickNodeCloneNodeSettingsForm extends QuickNodeCloneEntitySettingsForm {

  /**
   * The machine name of the entity type.
   *
   * @var string
   *   The entity type id i.e. node
   */
  protected $entityTypeId = 'node';

  /**
   * {@inheritdoc}
   */
  public function getFormId() {
    return 'quick_node_clone_node_setting_form';
  }

  /**
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state) {
    $form['text_to_prepend_to_title'] = [
      '#type' => 'textfield',
      '#title' => $this
        ->t('Text to prepend to title'),
      '#default_value' => $this
        ->getSettings('text_to_prepend_to_title'),
      '#description' => $this
        ->t('Enter text to add to the title of a cloned node to help content editors. A space will be added between this text and the title. Example: "Clone of"'),
    ];
    $form['clone_status'] = [
      '#type' => 'checkbox',
      '#title' => $this
        ->t('Clone publication status of original?'),
      '#default_value' => $this
        ->getSettings('clone_status'),
      '#description' => $this
        ->t('If unchecked, the publication status of the clone will be equal to the default of the content type.'),
    ];
    return parent::buildForm($form, $form_state);
  }

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    $form_state
      ->cleanValues();
    $form_values = $form_state
      ->getValues();
    $this
      ->config('quick_node_clone.settings')
      ->set('text_to_prepend_to_title', $form_values['text_to_prepend_to_title'])
      ->save();
    $this
      ->config('quick_node_clone.settings')
      ->set('clone_status', $form_values['clone_status'])
      ->save();
    parent::submitForm($form, $form_state);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ConfigFormBaseTrait::config protected function Retrieves a configuration object.
DependencySerializationTrait::$_entityStorages protected property An array of entity type IDs keyed by the property name of their storages.
DependencySerializationTrait::$_serviceIds protected property An array of service IDs keyed by property name used for serialization.
DependencySerializationTrait::__sleep public function 1
DependencySerializationTrait::__wakeup public function 2
FormBase::$requestStack protected property The request stack. 1
FormBase::$routeMatch protected property The route match.
FormBase::configFactory protected function Gets the config factory for this form. 1
FormBase::container private function Returns the service container.
FormBase::currentUser protected function Gets the current user.
FormBase::getRequest protected function Gets the request object.
FormBase::getRouteMatch protected function Gets the route match.
FormBase::logger protected function Gets the logger for a specific channel.
FormBase::redirect protected function Returns a redirect response object for the specified route. Overrides UrlGeneratorTrait::redirect
FormBase::resetConfigFactory public function Resets the configuration factory.
FormBase::setConfigFactory public function Sets the config factory for this form.
FormBase::setRequestStack public function Sets the request stack object to use.
FormBase::validateForm public function Form validation handler. Overrides FormInterface::validateForm 62
LinkGeneratorTrait::$linkGenerator protected property The link generator. 1
LinkGeneratorTrait::getLinkGenerator Deprecated protected function Returns the link generator.
LinkGeneratorTrait::l Deprecated protected function Renders a link to a route given a route name and its parameters.
LinkGeneratorTrait::setLinkGenerator Deprecated public function Sets the link generator service.
LoggerChannelTrait::$loggerFactory protected property The logger channel factory service.
LoggerChannelTrait::getLogger protected function Gets the logger for a specific channel.
LoggerChannelTrait::setLoggerFactory public function Injects the logger channel factory.
MessengerTrait::$messenger protected property The messenger. 29
MessengerTrait::messenger public function Gets the messenger. 29
MessengerTrait::setMessenger public function Sets the messenger.
QuickNodeCloneEntitySettingsForm::$configFactory protected property The Config Factory. Overrides FormBase::$configFactory
QuickNodeCloneEntitySettingsForm::$entityFieldManager protected property The Entity Field Manager.
QuickNodeCloneEntitySettingsForm::$entityTypeBundleInfo protected property The Entity Bundle Type Info.
QuickNodeCloneEntitySettingsForm::create public static function Instantiates a new instance of this class. Overrides ConfigFormBase::create
QuickNodeCloneEntitySettingsForm::fieldsCallback public static function AJAX callback function to return the excluded fields part of the form.
QuickNodeCloneEntitySettingsForm::getDefaultFields public function Returns the default fields. Overrides QuickNodeCloneEntitySettingsFormInterface::getDefaultFields
QuickNodeCloneEntitySettingsForm::getDescription public function Returns the description field. Overrides QuickNodeCloneEntitySettingsFormInterface::getDescription
QuickNodeCloneEntitySettingsForm::getEditableConfigNames public function Gets the configuration names that will be editable. Overrides ConfigFormBaseTrait::getEditableConfigNames
QuickNodeCloneEntitySettingsForm::getEntityBundles public function Returns the bundles for the entity. Overrides QuickNodeCloneEntitySettingsFormInterface::getEntityBundles
QuickNodeCloneEntitySettingsForm::getEntityTypeId public function Returns the entity type Id. i.e. article. Overrides QuickNodeCloneEntitySettingsFormInterface::getEntityTypeId
QuickNodeCloneEntitySettingsForm::getSelectedBundles public function Returns the selected bundles on the form. Overrides QuickNodeCloneEntitySettingsFormInterface::getSelectedBundles
QuickNodeCloneEntitySettingsForm::getSettings public function Return the configuration. Overrides QuickNodeCloneEntitySettingsFormInterface::getSettings
QuickNodeCloneEntitySettingsForm::setEntityType public function Sets the entity type the settings form is for. Overrides QuickNodeCloneEntitySettingsFormInterface::setEntityType
QuickNodeCloneEntitySettingsForm::__construct public function QuickNodeCloneEntitySettingsForm constructor. Overrides ConfigFormBase::__construct
QuickNodeCloneNodeSettingsForm::$entityTypeId protected property The machine name of the entity type. Overrides QuickNodeCloneEntitySettingsForm::$entityTypeId
QuickNodeCloneNodeSettingsForm::buildForm public function Form constructor. Overrides QuickNodeCloneEntitySettingsForm::buildForm
QuickNodeCloneNodeSettingsForm::getFormId public function Returns a unique string identifying the form. Overrides FormInterface::getFormId
QuickNodeCloneNodeSettingsForm::submitForm public function Form submission handler. Overrides QuickNodeCloneEntitySettingsForm::submitForm
RedirectDestinationTrait::$redirectDestination protected property The redirect destination service. 1
RedirectDestinationTrait::getDestinationArray protected function Prepares a 'destination' URL query parameter for use with \Drupal\Core\Url.
RedirectDestinationTrait::getRedirectDestination protected function Returns the redirect destination service.
RedirectDestinationTrait::setRedirectDestination public function Sets the redirect destination service.
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.
UrlGeneratorTrait::$urlGenerator protected property The url generator.
UrlGeneratorTrait::getUrlGenerator Deprecated protected function Returns the URL generator service.
UrlGeneratorTrait::setUrlGenerator Deprecated public function Sets the URL generator service.
UrlGeneratorTrait::url Deprecated protected function Generates a URL or path for a specific route based on the given parameters.