Commit 665015d6 authored by Florian Weber's avatar Florian Weber
Browse files

Issue #2983348: Convert code to short array

parent 88dfbc49
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -13,11 +13,11 @@ use Drupal\Core\Render\BubbleableMetadata;
 * Implements hook_token_info().
 */
function publication_date_token_info_alter(&$data) {
  $data['tokens']['node']['published'] = array(
  $data['tokens']['node']['published'] = [
    'name' => t("Date published"),
    'description' => t("The date the node was published."),
    'type' => 'date',
  );
  ];
}

/**
+3 −3
Original line number Diff line number Diff line
@@ -39,12 +39,12 @@ class TimestampDatetimeWidget extends WidgetBase {
    else {
      $default_value = '';
    }
    $element['value'] = $element + array(
    $element['value'] = $element + [
      '#type' => 'datetime',
      '#default_value' => $default_value,
      '#date_year_range' => '1902:2037',
    );
    $element['value']['#description'] = $this->t('Format: %format. Leave blank to use the time of form submission.', array('%format' => Datetime::formatExample($date_format . ' ' . $time_format)));
    ];
    $element['value']['#description'] = $this->t('Format: %format. Leave blank to use the time of form submission.', ['%format' => Datetime::formatExample($date_format . ' ' . $time_format)]);

    return $element;
  }
+3 −3
Original line number Diff line number Diff line
@@ -14,13 +14,13 @@ class PublicationDateNodePermissions extends NodePermissions {

  protected function buildPermissions(NodeType $type) {
    $type_id = $type->id();
    $type_params = array('%type_name' => $type->label());
    $type_params = ['%type_name' => $type->label()];

    return [
      "set $type_id published on date" => array(
      "set $type_id published on date" => [
        'title' => $this->t('Modify %type_name "Published On" date.', $type_params),
        'description' => $this->t('Change the "Published On" date for this content type.'),
      ),
      ],
    ];
  }

+6 −6
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ class PublicationDateTest extends BrowserTestBase {
   *
   * @var array
   */
  protected static $modules = array('node', 'user', 'publication_date');
  protected static $modules = ['node', 'user', 'publication_date'];

  /**
   * {@inheritdoc}
@@ -40,12 +40,12 @@ class PublicationDateTest extends BrowserTestBase {
      'name' => 'Page',
    ])->save();

    $this->privileged_user = $this->drupalCreateUser(array(
    $this->privileged_user = $this->drupalCreateUser([
      'create page content',
      'edit own page content',
      'administer nodes',
      'set page published on date',
    ));
    ]);
    $this->drupalLogin($this->privileged_user);
  }

@@ -55,7 +55,7 @@ class PublicationDateTest extends BrowserTestBase {
  public function testActionSaving() {

    // Create node to edit.
    $node = $this->drupalCreateNode(array('status' => 0));
    $node = $this->drupalCreateNode(['status' => 0]);
    $unpublished_node = Node::load($node->id());
    $value = $unpublished_node->published_at->value;
    $this->assertEquals($unpublished_node->published_at->value, PUBLICATION_DATE_DEFAULT);
@@ -119,7 +119,7 @@ class PublicationDateTest extends BrowserTestBase {
   * Test automatic saving of variables via forms
   */
  public function testActionSavingOnForms() {
    $edit = array();
    $edit = [];
    $edit["title[0][value]"] = 'publication test node ' . $this->randomMachineName(10);
    $edit['status[value]'] = 1;
    $this->drupalGet('node/add/page');
@@ -192,7 +192,7 @@ class PublicationDateTest extends BrowserTestBase {
  // Test that it cares about setting the published_at field.
  // This is useful for people using 'migrate' etc.
  public function testActionSavingSetDate() {
    $node = $this->drupalCreateNode(array('status' => 0));
    $node = $this->drupalCreateNode(['status' => 0]);
    $unpublished_node = Node::load($node->id());
    $this->assertEquals($unpublished_node->published_at->value, PUBLICATION_DATE_DEFAULT);