1

I'd like to create a node type in which I'd have an URL field, title and some description. Once I create a new node using this content type, Drupal would parse the contents of the URL I've added in the URL field. It'd work almost like one of these read it later services.

Is this possible, if its how? I've been looking into feeds, but its not exactly what I'm looking for (as it deals with rss/atom rather than url).

Background: Basically I'm creating a personal wiki using Drupal and wanted the ability to parse content directly to a node type. This way I can categorize the way I want as well as being able to create views, aggregate different content, etc. This is for a personal project and the site wouldn't be public.

  • there's no reason you can't use PHP's file_get_contents() function to grab whatever the url is pointing to and then populating a text field or otherwise parsing that returned information. – Jimajamma Aug 27 '13 at 12:40
0

Yes, it is possible using hook_node_insert or hook_node_presave. You will just need to implement it like:

function hook_node_insert($node) {
  if ($node->type == 'CONTENT_TYPE_MACHINE_NAME') {
    // get the URL content here
  }
}

You can do it using the hook_node_presave too. The only difference is that it is called before even the node is saved into the database.

  • Would there be a way to do it through a module or the UI? – WagnerMatosUK Aug 27 '13 at 15:10
  • You will have to do by creating a module. – Asad Aug 28 '13 at 4:51
0

If you have a lot of data/fields you'll be importing from these URL's, you can look into the migrate module, https://www.drupal.org/project/migrate. It has a really nice framework to migrate data in.

You can invoke the migration from multiple places, like the hooks Asad mentions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.