Commit d22df247 authored by Sharique Farooqui's avatar Sharique Farooqui Committed by Michelle Cox
Browse files

Issue #2339651 by Sharique: Fixes and updates to match core changes.

parent 321a8890
Loading
Loading
Loading
Loading
+3 −3
Changes for src/Entity/AuthorPane.php: 3 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -30,9 +30,9 @@ use Drupal\Core\Config\Entity\ConfigEntityInterface;
 *     "label" = "name"
 *   },
 *   links = {
 *     "edit-form" = "/admin/config/media/image-styles/manage/{image_style}",
 *     "delete-form" = "/admin/config/media/image-styles/manage/{image_style}/delete",
 *     "collection" = "/admin/config/media/image-styles",
 *     "edit-form" = "/admin/config/people/author_pane/edit/{author_pane}",
 *     "delete-form" = "/admin/config/people/author_pane/delete/{author_pane}",
 *     "collection" = "/admin/config/people/author_pane",
 *   }
 * )
 */
+6 −6
Changes for src/Form/AuthorPaneForm.php: 6 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ class AuthorPaneForm extends EntityForm {

    // Change page title for the edit operation
    if ($this->operation == 'edit') {
      $form['#title'] = $this->t('Edit Author Pane: @name', array('@name' => $authorPane->name));
      $form['#title'] = $this->t('Edit Author Pane: @name', array('@name' => $authorPane->label()));
    }

    // The author_pane name.
@@ -39,7 +39,7 @@ class AuthorPaneForm extends EntityForm {
      '#type' => 'textfield',
      '#title' => $this->t('Name'),
      '#maxlength' => 255,
      '#default_value' => $authorPane->name,
      '#default_value' => $authorPane->label(),
      '#description' => $this->t("Author Pane name."),
      '#required' => TRUE,
    );
@@ -48,7 +48,7 @@ class AuthorPaneForm extends EntityForm {
    $form['id'] = array(
      '#type' => 'machine_name',
      '#maxlength' => EntityTypeInterface::BUNDLE_MAX_LENGTH,
      '#default_value' => $authorPane->id,
      '#default_value' => $authorPane->id(),
      '#disabled' => !$authorPane->isNew(),
      '#machine_name' => array(
        'source' => array('name'),
@@ -61,7 +61,7 @@ class AuthorPaneForm extends EntityForm {
      '#type' => 'textfield',
      '#title' => $this->t('Description'),
      '#maxlength' => 255,
      '#default_value' => $authorPane->description,
      '#default_value' => $authorPane->getDescription(),
      '#description' => $this->t("Notes about how or where this Author Pane will be used."),
      '#required' => FALSE,
    );
@@ -81,12 +81,12 @@ class AuthorPaneForm extends EntityForm {
    if ($status) {
      // Setting the success message.
      drupal_set_message($this->t('Saved the Author Pane: @name.', array(
        '@name' => $authorPane->name,
        '@name' => $authorPane->label(),
      )));
    }
    else {
      drupal_set_message($this->t('The @name Author Pane was not saved.', array(
        '@name' => $authorPane->name,
        '@name' => $authorPane->label(),
      )));
    }

+5 −2
Changes for src/Plugin/Block/AuthorPaneBlock.php: 5 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -8,13 +8,14 @@ namespace Drupal\author_pane\Plugin\Block;

use Drupal\Core\Block\BlockBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\author_pane\Entity\AuthorPane;

/**
 * Provides a Author Pane block.
 *
 * @Block(
 *   id = "author_pane_block",
 *   admin_label = @Translation("Author Information")
 *   admin_label = @Translation("Author Information"),
 * )
 */
class AuthorPaneBlock extends BlockBase {
@@ -47,10 +48,12 @@ class AuthorPaneBlock extends BlockBase {
    // @TODO: Replace this with list of author panes.
    $options = array("default_pane");

    $config = $this->getConfiguration();

    $form['author_pane'] = array(
      '#type' => 'select',
      '#title' => $this->t('Which author pane to display?'),
      '#default_value' => $this->configuration['author_pane'],
      '#default_value' => $config['author_pane'],
      '#options' => $options,
    );