function _paragraphs_collection_demo_create_grid_article

Create demo grid article example.

Return value

\Drupal\Core\Entity\EntityInterface Returns node.

1 call to _paragraphs_collection_demo_create_grid_article()
paragraphs_collection_demo_install in paragraphs_collection/modules/paragraphs_collection_demo/paragraphs_collection_demo.install
Implements hook_install().

File

paragraphs_collection/modules/paragraphs_collection_demo/paragraphs_collection_demo.install, line 417
Installation hooks for paragraphs_collection_demo module.

Code

function _paragraphs_collection_demo_create_grid_article() {
  $paragraphs = [];

  // PARAGRAPH DEMO ITEMS: equal layout example with 3 items.
  $paragraphs[] = _paragraphs_collection_demo_create_text_paragraph('<h2>Equal columns example with 3 and 4 items</h2>');
  $grid_paragraphs = [];
  $grid_paragraphs[] = _paragraphs_collection_demo_create_text_paragraph('<p>We offer various grid layouts in demo. This one is showing three items all with the same size.</p>');
  $grid_paragraphs[] = _paragraphs_collection_demo_create_text_paragraph('<p>No matter how much items you add they will all be in the same size.</p>');
  $grid_paragraphs[] = _paragraphs_collection_demo_create_text_paragraph('<p>I am just another item so three equal cols example can be a reality.</p>');
  $paragraphs[] = _paragraphs_collection_demo_create_grid_paragraph($grid_paragraphs, 'paragraphs_collection_demo_equal_columns');

  // PARAGRAPH DEMO ITEMS: equal layout example with 4 items.
  $grid_paragraphs = [];
  $grid_paragraphs[] = _paragraphs_collection_demo_create_text_paragraph('<p>Professor, make a woman out of me. Good man. Nixon\'s pro-war and pro-family. Man, I\'m sore all over. I feel like I just went ten rounds with mighty Thor. I haven\'t felt much of anything since my guinea pig died.</p>');
  $grid_paragraphs[] = _paragraphs_collection_demo_create_text_paragraph('<p>With a warning label this big, you know they gotta be fun!</p>');
  $grid_paragraphs[] = _paragraphs_collection_demo_create_text_paragraph('<p>I barely knew Philip, but as a clergyman I have no problem telling his most intimate friends all about him.</p>');
  $grid_paragraphs[] = _paragraphs_collection_demo_create_image_paragraph('bill-williams-1806.jpg', 'Hummingbird');
  $paragraphs[] = _paragraphs_collection_demo_create_grid_paragraph($grid_paragraphs, 'paragraphs_collection_demo_equal_columns');
  $grid_paragraphs[] = _paragraphs_collection_demo_create_text_paragraph('<p>You can add as much items as you like and they are all going to be equal width. Enough with equals lets show some fixed stuff now.</p>');

  // PARAGRAPH DEMO ITEMS: 1 - 2 layout example.
  $paragraphs[] = _paragraphs_collection_demo_create_text_paragraph('<h2>How about two columns layout in 1/3 of a steps?</h2>');
  $grid_paragraphs = [];
  $grid_paragraphs[] = _paragraphs_collection_demo_create_text_paragraph('<p>Our first example is showing two text items in 1 - 2 grid layout.</p>');
  $grid_paragraphs[] = _paragraphs_collection_demo_create_text_paragraph('<p>We don\'t have a brig. You lived before you met me?! Fetal stemcells, aren\'t those controversial? Leela, are you alright? You got wanged on the head. Well, thanks to the Internet, I\'m now bored with sex. Is there a place on the web that panders to my lust for violence?</p><ol><li>I could if you hadn\'t turned on the light and shut off my stereo.</li><li>Oh dear! She\'s stuck in an infinite loop, and he\'s an idiot! Well, that\'s love for you.</li><li>Soothe us with sweet lies.</li></ol>');
  $paragraphs[] = _paragraphs_collection_demo_create_grid_paragraph($grid_paragraphs, 'paragraphs_collection_demo_1_2_column');

  // PARAGRAPH DEMO ITEMS: 2 - 1 layout example.
  $grid_paragraphs = [];
  $grid_paragraphs[] = _paragraphs_collection_demo_create_text_paragraph('<p>"<strong>Space: the final frontier.</strong><br/>
These are the voyages of the starship Enterprise. Its five-year mission: to explore strange new worlds; to seek out new life and new civilisations; to boldly go where no man has gone before." - <em>Captain James T. Kirk</em></p>');
  $grid_paragraphs[] = _paragraphs_collection_demo_create_image_paragraph('nasa-43566.jpg', 'Planet Earth');
  $paragraphs[] = _paragraphs_collection_demo_create_grid_paragraph($grid_paragraphs, 'paragraphs_collection_demo_2_1_column');

  // PARAGRAPH DEMO ITEMS: 1 - 2 - 1 layout example.
  $paragraphs[] = _paragraphs_collection_demo_create_text_paragraph('<h2>Adding 25% width step for grid more mixin options</h2>');
  $grid_paragraphs = [];

  // Slider paragraph with images.
  $images[] = _paragraphs_collection_demo_create_image_paragraph('ales-krivec-1881.jpg', 'Lake and Mountain');
  $images[] = _paragraphs_collection_demo_create_image_paragraph('ales-krivec-434.jpg', 'Green Lake and Mountain');
  $images[] = _paragraphs_collection_demo_create_image_paragraph('joshua-k-jackson-121873.jpg', 'Cathedral From Top');
  $images[] = _paragraphs_collection_demo_create_image_paragraph('frantzou-fleurine-16979.jpg', 'The Waves');
  $images[] = _paragraphs_collection_demo_create_image_paragraph('annie-spratt-114046.jpg', 'Giving is Caring');
  $slider_paragraph = Paragraph::create([
    'type' => 'slider',
    'field_slides' => $images,
  ]);
  $slider_paragraph
    ->setBehaviorSettings('slider', [
    'slick_slider' => 'default',
  ]);
  $slider_paragraph
    ->save();
  $grid_paragraphs[] = $slider_paragraph;

  // Other two text items.
  $grid_paragraphs[] = _paragraphs_collection_demo_create_text_paragraph('<p>25 - 50 - 25 example, and yeah you can put what ever you want for grid items, text, images or complex components.</p>');
  $grid_paragraphs[] = _paragraphs_collection_demo_create_text_paragraph('<p>Every grid brings us closer to the next content editor nirvana:)</p>');
  $paragraphs[] = _paragraphs_collection_demo_create_grid_paragraph($grid_paragraphs, 'paragraphs_collection_demo_1_2_1_column');
  $paragraphs[] = _paragraphs_collection_demo_create_text_paragraph('<h2>What next?</h2><p>As the last info our demo grid layout rules are responsive out of the box. For small screen size we resize all grid items to 100% width - just try it your self, resize the screen and test responsive behaviors. It\'s also easy to add more complex responsive rules, CSS grid rules are defined by frontend developers and they have full control of grid layouts rules they want to use.</p>');
  return _paragraphs_collection_demo_create_node('More Grid Examples', $paragraphs);
}