Drupal StackExchange

How to export custom module form content as PDF file in drupal 7?

2 days 21 hours ago

I have a custom module with some form fields. I want to submit this form and generate pdf file of user filled values in new tab. I am trying with TCPDF but it doesn't display any fieldset ( as border ).

In submit funciton , I am taking $form array and using drupal_render($form) that render form values as html ( if I print ). If I pass this html to WriteHTML($html, true) , it gives pdf but there is no styling left on that form.

atyagi

The Facebook Autopost module "user hasn't authorized the application"

2 days 22 hours ago

I have a problem with the Facebook Autopost module for Drupal 7.28): After publishing a node, I get an authorization error.

Facebook SDK threw an error: OAuthException: (#200) The user hasn't authorized the application to perform this action

I have checked permissions "Publish Actions", "Publish Stream", "Manage Pages" for Administrator role in fbpermissions module.

Also, I have submitted "manage_pages" in my app but cannot submit "publish_actions" because of this:

It looks like you haven't made any API requests to access content with the publish_actions permission in the last 30 days.

Don't know what to do now. Have no idea why it's not working and what Facebook app permissions are missing. Was googling it for an about 2 hours. Checked all found solutions... none of them worked...

Jazi

Set node to flagged by default

3 days 1 hour ago

I'm using flags on my site as a way of filtering content through views, when a user views a certain node content type, I have a rule setup which resets the value of my flag and sets it against that user for that node, the views will reference this information and change their output accordingly.

The problem I have at the moment is what happens when anonymous users enter the site for the first time, they have no flag set, and thus none of the views show anything, until they travel to one of these special nodes.

What I'm looking for is: is it possible to set a flag to a default value, so that everyone has this node tagged until it gets changed?

Andrew Morris

Action links available options / caching

3 days 2 hours ago

I have some action links defined in module.links.actions.yml which uses a custom "create entity" route. For entity creation I set up some restrictions and at some point the access is denied. The problem is that whilst the access to the page is denied, the action link is still visible until I clear all caches.

Is there a way to tell Drupal not to cache the links or to programmatically clear the links cache? Or some options I can add in the yml file to prevent caching?

Thanks.

Marius Ilie

Styling a "programmatically created block" in drupal 10

3 days 3 hours ago

I'm new to Drupal dev, I'm messing around creating some custom modules and explore how the env of drupal 10 works... I've created a custom block that i called "Copyright":

<?php declare(strict_types=1); namespace Drupal\plugin_play_module\Plugin\Block; use Drupal\Core\Block\Attribute\Block; use Drupal\Core\Block\BlockBase; use Drupal\Core\StringTranslation\TranslatableMarkup; #[Block( id: 'copyright_block', // id is the internal machine name, admin_label: new TranslatableMarkup('Copyright'), category: new TranslatableMarkup('Custom') ) ] class Copyright extends BlockBase { #[\Override] public function build(): array { $date = new \DateTimeImmutable(); return [ '#markup' => \t('Copyright @year&copy; My Company', ['@year' => $date->format('Y')]), ]; } }

and after I placed it in footer region using UI, I wanted to style it a little... Based on some inspection:

I have added some css:

.block__content{ text-align: center; color: green; }

but at the end, nothing changed here's the config for that custom module :

#plugin_play_module.info.yml name: Plugin Play Module description: playing with plugins type: module core_version_requirement: '>=9' libraries: - plugin_play_module/copyright_block #plugin_play_module.libraries.yml copyright_block: css: layout: css/styles.css: {}

here the tree structure of the web/modules/plugin_play_module

│   ├── plugin_play_module │   │   ├── **css** │   │   │   └── styles.css │   │   ├── **js** │   │   ├── plugin_play_module.info.yml │   │   ├── plugin_play_module.libraries.yml │   │   ├── plugin_play_module.module │   │   ├── plugin_play_module.services.yml │   │   ├── **src** │   │   │   └── **Plugin** │   │   │   ├── **Block** │   │   │   │   └── Copyright.php │   │   │   ├── ...
tsukingo

Drupal Planet

Drupal Association blog: Making the Most of Your Time at DrupalCon Portland

3 days 3 hours ago

It’s less than two weeks to DrupalCon Portland 2024, and the excitement is building! If you’re gearing up for the biggest Drupal event of the year, we’re here to help you maximize your travel experience to Portland. Let’s dive right in!

Hotel Bookings at Great Prices

You still have a chance to book your DrupalCon Portland hotel within the official hotel block. By staying within the hotel block, you'll get the best proximity to the conference center as well as the chance to run into other Drupalists on your floor! Book now:

When and where is DrupalCon’24 happening in Portland?

DrupalCon North America 2024 will be held from 6th to 9th May 2024 at the Oregon Convention Center (yes, in-person!). Located right in the heart of the city, it is a perfect hub for exploration. You'll find hotels, restaurants, and shops just around the corner. It's also super easy to get to fun stuff like entertainment and hiking. With endless possibilities, you're sure to find something that suits your fancy.

Things you should NOT miss out on in Portland

May is a delightful time to be in Portland, with spring in full bloom. Enjoy the sunny weather and mild temperatures, making it the perfect season to explore the city's vibrant outdoor scene. There are several must-visit places that capture the city's unique charm.

1. Governor Tom McCall Waterfront Park

This is the perfect place to enjoy Portland's beauty while watching the river flow by. Visitors to the park can enjoy a variety of recreational activities, from leisurely strolls and picnics to jogging and biking along the paved pathways. The park also hosts numerous events throughout the year, including festivals, concerts, and outdoor markets, adding to its vibrant atmosphere.

One of the park's highlights is the Salmon Street Springs Fountain, where children and adults alike can cool off in the refreshing water jets during the warmer months. The park also features several monuments and public art installations, adding cultural and historical significance to its landscape.


Image Source: https://www.travelportland.com/attractions/governor-tom-mccall-waterfront-park/

2. Powell's City of Books

Powell's City of Books is a literary wonderland located in downtown Portland, Oregon. As the world's largest independent bookstore, Powell's spans an entire city block and boasts multiple floors filled with books of every genre imaginable. One of Powell's most unique features is its rare book room, home to a collection of rare and out-of-print titles, first editions, and signed copies that will delight bibliophiles and collectors alike.

In addition to its vast selection of books, Powell's hosts author readings, book signings, and other literary events, fostering a sense of community among book lovers from near and far.


Image Source: https://www.travelportland.com/attractions/powells/

3. Portland Art Museum

Founded in 1892, the Portland Art Museum is the oldest art museum on the West Coast and holds a rich and diverse collection of artworks spanning various time periods, cultures, and mediums. It is located in the heart of downtown Portland. One of the museum's highlights is its extensive collection of Native American art, which celebrates the rich artistic traditions of indigenous peoples from the Pacific Northwest and beyond. 

In addition to its permanent collection, the Portland Art Museum hosts rotating exhibitions that showcase both established and emerging artists, offering visitors the opportunity to engage with cutting-edge contemporary art and explore new perspectives.


Image Source: https://www.travelportland.com/attractions/portland-art-museum/

4. Voodoo Doughnut

Voodoo Doughnut is more than just a bakery; it's a Portland icon, a symbol of creativity, and a culinary experience like no other. It was founded in 2003 by friends Kenneth Pogson and Richard Shannon and has gained international fame for its wacky doughnut creations.

It is located in the heart of downtown Portland, Voodoo Doughnut draws long lines of locals and tourists, eager to sample its unique offerings. Some of the must-try snacks: Voodoo Doll doughnut, pretzel stake and raspberry filling, Bacon Maple Bar topped with crispy bacon strips. If this has got you drooling (like me), make sure you head to this place while you’re at Portland.


Image Source: https://www.travelportland.com/attractions/voodoo-doughnut/

5. Oregon Museum of Science and Industry 

The Oregon Museum of Science and Industry (OMSI) is a beloved institution in Portland, Oregon, dedicated to inspiring curiosity and fostering a love of science through engaging exhibits, interactive displays, and educational programs. Located on the east bank of the Willamette River, OMSI's sprawling campus encompasses a variety of attractions that cater to visitors of all ages. 

OMSI's planetarium is a highlight, where visitors can explore the wonders of the night sky, learn about astronomy and astrophysics, and take virtual journeys through space. The museum also features a state-of-the-art IMAX theater, where visitors can experience immersive films on topics ranging from nature and wildlife to history and technology.


Image Source: https://www.travelportland.com/attractions/omsi/

Find more information to plan your trip here.

Drupalize.Me: Learning Drupal with the Help of an AI Tutor

3 days 5 hours ago
Learning Drupal with the Help of an AI Tutor

TL; DR: Use this prompt and the text from a Drupalize.Me tutorial to experiment with using generative AI as a tutor for learning Drupal.

A while ago, I wrote an article and gave a presentation about why learning Drupal is so hard. One of the key challenges I identified is the “pit of despair”. It's that point in the learning journey where you can no longer rely on the hand holding of step-by-step tutorials. You need to step out into the chasm and come up with your own unique solutions to your specific problems. That point where you know just enough to realize the breadth of what you don’t yet know. And I had said, based on input from many peers, that the quickest way through the dip is real-world experience and drawing on the expertise of others. The advice could be summed up as: if you want to learn fast, get a tutor.

It can be hard to find a mentor. As much as we would love to be able to do so, our small team at Drupalize.Me can't scale personalized individual tutoring. So I've been thinking about how you might be able to use AI to help get at least some of the benefits of tutoring.

joe Thu, 04/25/2024 - 11:29