Loading src/Form/PrintableConfigurationForm.php +8 −3 Changes for src/Form/PrintableConfigurationForm.php: 8 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -119,9 +119,14 @@ class PrintableConfigurationForm extends ConfigFormBase { // Provide option to turn off link extraction. $form['settings']['extract_links'] = [ '#type' => 'checkbox', '#title' => $this->t('Extract Links'), '#description' => $this->t('Extract any links in the content, e.g. "Some Link (http://drupal.org)'), '#type' => 'radios', '#title' => $this->t('Link handling'), '#description' => $this->t('Choose what happens with to any links in the content.'), '#options' => [ 'extract' => 'Extract (show the URL in brackets)', 'remove' => 'Remove (delete the "href=")', 'none' => 'Unchanged', ], '#default_value' => $this->config('printable.settings') ->get('extract_links'), ]; Loading src/Plugin/PrintableFormatBase.php +10 −7 Changes for src/Plugin/PrintableFormatBase.php: 10 added lines, 7 removed lines. Original line number Diff line number Diff line Loading @@ -213,16 +213,19 @@ abstract class PrintableFormatBase extends PluginBase implements PrintableFormat * The HTML of the page to be added. * * @return string * The HTML string with presence of links dependending on configuration. * The HTML string with presence of links depending on configuration. */ protected function extractLinks($content) { if ($this->configFactory->get('printable.settings')->get('extract_links')) { $rendered_page = $this->linkExtractor->extract($content); } else { $rendered_page = $this->linkExtractor->removeAttribute($content, 'href'); switch($this->configFactory->get('printable.settings')->get('extract_links')) { case 'extract': return $this->linkExtractor->extract($content); case 'remove': return $this->linkExtractor->removeAttribute($content, 'href'); default: return $content; } return $rendered_page; } /** Loading Loading
src/Form/PrintableConfigurationForm.php +8 −3 Changes for src/Form/PrintableConfigurationForm.php: 8 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -119,9 +119,14 @@ class PrintableConfigurationForm extends ConfigFormBase { // Provide option to turn off link extraction. $form['settings']['extract_links'] = [ '#type' => 'checkbox', '#title' => $this->t('Extract Links'), '#description' => $this->t('Extract any links in the content, e.g. "Some Link (http://drupal.org)'), '#type' => 'radios', '#title' => $this->t('Link handling'), '#description' => $this->t('Choose what happens with to any links in the content.'), '#options' => [ 'extract' => 'Extract (show the URL in brackets)', 'remove' => 'Remove (delete the "href=")', 'none' => 'Unchanged', ], '#default_value' => $this->config('printable.settings') ->get('extract_links'), ]; Loading
src/Plugin/PrintableFormatBase.php +10 −7 Changes for src/Plugin/PrintableFormatBase.php: 10 added lines, 7 removed lines. Original line number Diff line number Diff line Loading @@ -213,16 +213,19 @@ abstract class PrintableFormatBase extends PluginBase implements PrintableFormat * The HTML of the page to be added. * * @return string * The HTML string with presence of links dependending on configuration. * The HTML string with presence of links depending on configuration. */ protected function extractLinks($content) { if ($this->configFactory->get('printable.settings')->get('extract_links')) { $rendered_page = $this->linkExtractor->extract($content); } else { $rendered_page = $this->linkExtractor->removeAttribute($content, 'href'); switch($this->configFactory->get('printable.settings')->get('extract_links')) { case 'extract': return $this->linkExtractor->extract($content); case 'remove': return $this->linkExtractor->removeAttribute($content, 'href'); default: return $content; } return $rendered_page; } /** Loading