texts: Cannot send drupal_http_request authorization header

texts:
I'm trying to post a request using drupal_http_request, but my headers are causing authorization errors.

This is my request:

$headers =  array('Authorization'=>'Bearer [my token here]', 'Content-Type'=>'application/json' );
$url = "https://api.ionic.io/push/notifications";
$message= new stdClass();
$message->message='That works';
$message->title='titleofmessage';
$data = array('tokens' => array('DEV-f765ac70-1bcb-4e0f-8bfd-adfd9612f185'), 'profile'=>'fake_push_profile', 'notification'=>$message);
$result=drupal_http_request($url, $headers, 'POST', json_encode($data));

In cURL it works fine, but I want to use drupal_http_request:

curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer [my token here]" -d '{"tokens": ["DEV-f765ac70-1bcb-4e0f-8bfd-adfd9612f185"],"profile": "fake_push_profile","notification": {"message": "That works", "title": "titleofmessage"}}' "https://api.ionic.io/push/notifications"

The error message I get is 'Authorization header is missing' so something seems to be happening to that header.

Any help much appreciated!


texts:
I'm using Search API with Facets and a view to display the results. Everything works as expected but I would like to have a reset button per facet, that could be used as a "Show all" button.

For the moment I'm using facets_preprocess_facets_item_list(&$variables) to create an extra item on the top of every list, eg.

Facet 1 : Region All regions, Region 1, Region 2, ...
Facet 2 : Financial support All financial supports, Financial support 1,
Financial support 2, ...
Facet 3 : Status All statuses,
Status 1, Status 2, ...
Facet 4 : Sector All sectors, Sector
1, Sector 2, ...

To construct the "All ..." links, I'm getting the parameters of the current page and I clean up the filters. For example if the user clicks on the "All financial supports" [facet 2] link while the current page parameters are
../organizations?[facet 1]organizations%5B0%5D=region%3A18&[facet 2]organizations%5B1%5D=financial_support%3A1&[facet 3]organizations%5B2%5D=status%3A10&[facet 4]organizations%5B3%5D=sector%3A28the parameters become ../organizations?[facet 1]organizations%5B0%5D=region%3A18&[facet 2][facet 3]organizations%5B2%5D=status%3A10&[facet 4]organizations%5B3%5D=sector%3A28

It works, but I'm not conviced that this is the best solution because I've managed to dramaticaly slow down the display of the view and, well... it's not very elegant.

Do you know if there is another, more Drupalish solution to implement a reset button per facet?
Thank you in advance for your help.


texts: Autocomplete term widget (tagging) - Insert as child

texts:
Is there a way to insert taxonomy terms as child of a parent term with the auto complete term widget?

I have found several modules such as "Content Taxonomy" or "Hierarchical Term Reference Autocomplete", but couldn't find this specific feature.


texts: Views managing fields with style in Drupal7

texts:
i have created a view

having three fields   as image , title and  body

i want to show image on left and  on right hand side title and below title body .

i don't want to customize view template file. is there is any option so i will get desired results .

Thanks in advance


texts: Paypal IPN does not create Commerce Order

texts:
I use drupal commerce and paypal wps for payment. If you pay and folllow the links back to my site, the order is created. But if you just pay and leave the site, no order is created although an IPN is showing up in the log ([payment_status] => Completed).

I'm working with a live version, no localhost.
Can someone help me, please?


texts: Triggering an action after user resets password?

texts:
I was hoping there was hook_user_pass_reset, but I seem to be out of luck. Some background:

I made a new field on users called "email_confirmed"
This field gets set = 1 when the user has confirmed their email address
I don't use the "blocked" value, or the normal Drupal way, because I want users to still log in and do stuff. I only want to limit certain actions, which will only become possible after email_confirmed = 1

So all I want to do is update this field = 1, the moment the user uses the confirmation link to change their password. So it will not be good enough to this when the user changes his password. It needs to happen the moment the user has executed the confirmation link?


texts:
I am using jQuery Colorpicker for some reasons i need to set change the values of the fields directly from javascript.

I found this function HERE in the plug in website

jQuery('input').ColorPickerSetColor(color);

But no luck. Have you experienced something like this. What is the way to do this? Is there any other modules i can use ?


texts: In Drupal 6 how to get two dates from url and filter content in views based on date range?

texts: I have one view where i am displaying contents. I want to pass 2 dates from view url, which will be content post dates. I want to know how to get dates from url and filter content between the date range.


texts: Index data under Solr from a SOAP web service to expose them via Search API (views)

texts:
We have to expose a subset of an external database coming via SOAP.
To keep it simple, let's say that we have to handle products, product providers and product categories under Drupal.
Products are search results candidates. Product providers and categories are search filters (e.g. facets).

Due to the amount of items, we decided to use Solr but are still opened to other solutions (Elastic Search, ...).
However, I do not think that the search solution has any incindence on the question.

A first solution is to cache the data from the web service into Drupal entities.

Pros :

lowers the network load
the whole Drupal ecosystem (Search API, Views, templates, ...) can be used as is
the web service can be simplified (filters, pagination, ...)

Cons :

write a sync mechanism (create, update, delete) between SOAP data and Drupal entities
maintain an extra layer in case of change.

Any thoughts on this ?

Thanks


texts:
I have a View setup in Drupal that is a list of products. Each product has an associated location and all of the locations in a view are displayed in a map that is on the bottom of the page.

What I'd like to do is to bring the map "INTO" the view so that it works better with the flow of the page. Here's the layout:

Table

 col col map map
 col col map map
 col col col col
 col col col col

What would be the best way of integrating the map with the table?


texts:
Trying to figure out how to create menu paths to have a custom page available for each organic group. The page for each will have unique content that will use custom logic (no views). The page should also know what the active group is based on the URL.

A few questions:

1) What path should I be using?
2) What function should I be using in my page callback to set the og context?

**I was trying to find an existing module to just inspect how they setup the callbacks and menu paths but i couldn't find anything.

<?php
function ogtest_menu() {

$items = array();

// not sure if this is correct. would like to be able to setup an alias so that eventually the path could be mydomain.com/mygroup/hellopage
$items['node/%/hellopage'] = array(
  'type' => MENU_CALLBACK,
  'description' => 'Post a my_content_type for this group.',
  'access callback' => TRUE,
  'page callback' => 'ogtest_page',
  'page arguments' => array(1),
);

return $items;

function ogtest_page($args) {

  // set og context?

  $output = array();

  $output['text'] = array(
    '#markup' => t('Hello'),
  );
}


texts: How to define custom content entity one to many relationship?

texts:
I have two custom entities; A, B.

In terms of database relationships, I want A to have many B.

I find I am able to define a reference_entity field in the entity's baseFieldDefinition(). However, because this just defines a single column in the database my relationships are back to front:

I can give B a reference to A and then use $B->getEntity()->referencedEntities() to get a B's associated A, but I can't do it the other way round because there's just a single id for each row.

Is there a correct way to query or set up these kinds of relationships 'out-the-box' or is a better solution to add my own method to the A entity getReferencedBs() and query the B table for references to A.

Many thanks


texts: Where in the database is the password reset form's expiration date set?

texts:
I'd like to be able to change the text in the temporary login page but I don't know where the expiration date for the form can be found. Getting the username is simple enough and I left the login button as is. The date is the only thing left.

Alternatively, can I do this in the drupal admin without having to code anything? Something similar to the email alerts, including options for multiple languages?


texts:
I have a custom module which implements  hook_node_view() and checks certain conditions to decide whether a user can view the content or not. The code snippet is:

    if( ! user_is_logged_in() && $node->type == "abc") {
        drupal_access_denied();
        module_invoke_all('exit');
        exit();
    }
    else {
        //do nothing
    }
}

The code works fine for me but the problem occurs when drupal's cron runs as Anonymous user. The only message I get is Attempting to re-run cron while it is already running. Could you please give me your suggestion to handle this.


texts: Count of child nodes of a specific content type

texts:
I have a content type Grants, with multiple other "child" content types that have a node reference GrantID back to the Grant content type. For example, Sub-Grants and Publications are two of the other content types, both with a node reference GrantID.

I'd like to have a view of Grants, displaying a table of each grant that has columns with the total number of Sub-Grants, Publications, etc. For example, grant 511 has 21 sub-grants and 15 publications.

Using aggregation and a relationship with GrantID (field_grantid) - reverse I can get a count of ALL the times that GrantID has been used by any other content type (36 in the example above). How do I just get the count of Sub-grants vs. Publications?


texts: Make Entity API aware of new custom field

texts:
I am using a module that creates a field type "ean_hotel_hotelid".  I am using Search API and need to index this field, but it is not available to be indexed.  Search API will index all fields and field types that are recognized by Entity API.

So I am using an implementation of hook_entity_property_info_alter.  The field data is stored in the database in a field called "field_expedia_hotel_id_ean_hotel_id", but the field_config table has the field set up as field_name "field_expedia_hotel_id" and type "ean_hotel_hotelid".

However, I can not get Entity API to see this new field.  I based my hook implementation on this.  Here is my code:

/**
 * Getter callback for EAN Hotel ID Property.
 */
function bartheme_ean_hotel_id_getter_callback() {
  return variable_get('field_expedia_hotel_id_ean_hotel_id', array());
}

/**
 * Adds 'Hotel ID' (EAN module) field type as an indexable field in Search API.
 */
function bartheme_entity_property_info_alter(&$info) {
  $info['node']['properties']['field_expedia_hotel_id'] = array(
    'type' => 'struct',
    'bundle' => 'hotel',
    'label' => t('Expedia Hotel ID'),
    'sanitized' => FALSE,
    'getter callback' => 'bartheme_ean_hotel_id_getter_callback',
    'property info' => array(
    'type' => 'ean_hotel_hotelid',
    ),
  );
  }

I have tried several different variations, but can not get Entity API to recognize this field.  What is wrong?


texts: How to convert location module data to geofield?

texts: I need to switch my mapping implementation from Gmap to OpenLayers. I have a site with 1000+ users that already have data stored with the location module, and user locations. Is there an easy way to transfer the address/location to geofield?


texts:
Hello i have an anchor link set up  bottom  etc etc. I am finding it hard to locate what tpl file i should be adding or altering to ad the link so as i link to the comment box itself. I can get it in the footer etc just not the comment box. Anyone suggests anything for me?

thanks


texts: Is it possible that search could index token content?

texts:
Using the Token module with the Token Filter module, one can put a token in the body of a node.

When visitors search for a content they would like to find whatever is show in page, no matter how is it placed there. However, tokens are only replaced before node renders. Is it possible that the search mechanism could index the token content?


texts: How to remove 'destination' query paramater from link URLs in Drupal 8

texts:
For some SEO related reasons, I want to remove the destination paramaters that are attached to the login and register link urls below nodes.

The Link-URLs look like this:

http://example.com/user/login?destination=node/55%23comment-form

But I want it that way:

http://example.com/user/login

For Drupal 7, someone has made it with:

function moon_url_outbound_alter(&$path, &$options, $original_path) {
 // here "moon" is my theme, use your own.
  switch ($path) {
  case 'user/login':
  unset( $options['query']['destination'] );
  break;
 }
}

Source: How to remove the Destination parameter from an URL in Drupal 7?

This source https://www.drupal.org/node/2238759 says, in Drupal 8 hook_url_outbound_alter has been replaced with OutboundPathProcessorInterface. But with the given example there, I don't understand how I could make it to unset the destination paramaters with my .theme file.

Can someone please help and tell how to unset the destination paramaters in Drupal 8 ?

Thanks in Advance!


texts: Print taxonomy information based on the link that is clicked

texts:
Lets say I have a taxonomy called fruits. I have 3 links on my front page and the href-s are:

fruits/bananas
fruits/oranges
fruits/apples

I made a custom module to do this but I am not really sure what to do next...

function mymodyle_menu() {
    $items['fuits/%'] = array(
      'page callback' => 'mymodule_fruits',
      'access callback' => TRUE
    );
    return $items;
  }

  function mymodule_fruits() {
  //what to do?
}

I also have a template file for them. How to do this?


texts: getting response back from a Java Servlet to Drupal

texts:
My working scenario is like this,
A webform (suppose an admission form for school) should be there on my drupal site and when a user clicks "submit" button a nicely formatted pdf file should be generated.

my approach is like this:
1. I have created a webform using webform module

I have written a servlet to generate pdf file (currently hosted at another server)
now I want to have communication between my servlet and drupal, so I created a small
module that will execute custom function whenever user clicks submit button of the webform.

I am using curl to send the form data to servlet and it is working with http code 200.following is my code.

define("URL","http://localhost:8080/pdf?");
//my data actuly its coming from the webform
$fields = array(
  'name'=>'deepak',
);

$fields_string = http_build_query($fields);
drupal_set_message($fields_string);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, URL);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$response = curl_exec($ch);
curl_close($ch);

I am getting the PDF file encoding printed in the browser. How can I force User to download it.

please guide me.


texts: user:role:add for email addresses in Drush 9/10?

texts:
In Drush 8, you can add a role to an email address like this:
drush user-add-role "power user" --mail=penguin@example.com

In Drush 9, the --mail option no longer exists for user:role:add.
So, if I only have an email address, how can I add a role to the user account?


texts: How can we discover the machine name of $conf keys?

texts: This is part of an interview questions and I am not sure. How can we discover the machine name of $conf keys from standard administrative settings forms by inspecting the DOM? (Assume it is in drupal 7)


texts: Creating a view of relation fields limited to the relations that a currently viewed node is an endpoint of

texts:
To first explain the set up, I have a custom content type that represents a candidate. I have a relation between candidate and users where the relation has some fields (using the relation module). I want to have a view that displays the fields of relation on the candidate page that has that relation.

So far I have tried Entity Views Attachment but the issue with that is it adds the relation view I have set up to every instance of candidate. I've also been trying view reference but that doesn't seem to be the module I'm after either.

I think I need to add something like an extra filter or something to the EVA view that only will show relations that involve the current candidate node, but I'm not sure if that is possible or not.


texts: customizing an info window with geolocation views

texts:
I have been beating myself up a lot with this problem.  I can't for the life of me figure it out.

I am using Drupal 7, using the geolocation module, specifically the views part.

I am essentially trying to put a view for each node within this map view.

It works really well, however, it doesn't render in a particularly nice way for the user.

I am guessing that I can sort this out in css.  However, I can't for the life of me figure out which div class to alter.  The one that I think I want to alter is just a standard Div tag.  I am sure I am missing something, but I just can't work it out.  I tried altering the .balloon class, but got some weird results.

Thanks in advance,

Mark.


texts:
When I try to make a new Basic Page, I get the error below:

Recoverable fatal error: Object of class Drupal\node\Entity\NodeType could not be converted to string in Drupal\Component\Utility\Html::getClass() (line 72 of core/lib/Drupal/Component/Utility/Html.php).

I am currently on 8.3.7, but I get the same error when upgrading to 8.4.2 as well. This happens for creating all content types. Has anyone else come across this? I am a little worried since it is a core issue, but I assume it is some kind of configuration issues. Any help is greatly appreciated.


texts:
Viewing the syslog, I see errors like for the Twitter Module 7.x-5.11

Do you have an idea of how to solve it?

'TwitterException' with message 'Not Found' in /home/superstar/public_html/sites/all/modules/twitter/twitter.lib.php:164#012Stack trace:#012#0 /home/superstar/public_html/sites/all/modules/twitter/twitter.lib.php(117): Twitter->request('https://api.twi...')#012#1 /home/superstar/public_html/sites/all/modules/twitter/twitter.lib.php(1248): Twitter->auth_request('https://api.twi...',


texts:
I am currently writing a custom module - block plugin for Drupal 8 - How do i go about consuming/sending external API data and displaying them using blocks?

Is this the standard way - consume/send external API data via plugin directly or through a controller and output it to a twig template?
If so, how do i send data from controller to a custom plugin block?

Any suggestion is welcome. Thank you.


texts: How to attach css classes to the  title attributes if node_is_page() dynamically?

texts:
To preprocess the node title field is obviously not the easiest. It has its place in the node.tpl.php and in the page.tpl.php by default and it has its own status in Drupal core, which makes it not fieldable as simply as other fields and entities in a given content type bundle.

That's why there are many discussions going on at drupal.org and some little helper modules are also around already, to make the title field more flexible in different scenarios like field translation, label design, field order and much more. So if this is your problem you will easely find a little module helping you.

But what if you don't want to touch the behaviour of the title field as designed in core but only want to preprocess the title to change the markup dynamically? Suddently google keeps silent. Unlike others I agree with some core contributors who explain wisely why the title field has its reasonable difficulties and why the decision to make it simply a "field like others" is not THAT easy to make. So for some reasion I need a solution in template.php

This is how the page.tpl.php looks like in my case:

// page.tpl.php

<?php print render($title_prefix); ?>
    <?php if ($title): ?>
        <?php if ($page): ?>
            <!-- This is where we want to get in with template.php -->
            <h1 <?php print $title_attributes; ?>>
                <?php print $title; ?>
            </h1>
        <?php endif; ?>
    <?php endif; ?>
<?php print render($title_suffix); ?>

And this the place where we obvisously should try to make it happen:

// template.php

function YOURTHEME_process_page(&$variables) {
    if ($variables['view_mode'] == 'full' &&
        node_is_page($variables['node'])) {
            // do something with $variables['title']['attributes'][];
    }
}

But to be honest, I am a little bit lost here, since I only want to change the rendering of <h1> to <h1 class="my_css_class">. Does anybody has an idea of how to achieve this?

The attributes class seems not to exist this way, because I get an Unknown index warning and the class gets not attached. Or maybe I have to point to $title another way? Maybe something like $node->title ? I know how to wrap the title with a new container, or how to change the suffix/prefix. But here would really appreciate your thoughts. Thank you very much ...


texts:
I have this purchase module defined. And I have implemented the update hook something like this

<?php
  function purchase_update($node) {
    echo 'Updating';
    exit(0);
  }

  function purchase_help($path, $arg) {
    $output = '';
    switch ($path) {
      case "admin/help#purchase":
        $output = '<p>'.  t("Update help") .'</p>';
        break;
    }
    return $output;
  }

However, whenever I edit a node of type purchase, it doesn't call my update function. Any suggestions what could go wrong?


texts: Override Profile2 with account fields and values

texts:
I have created a new Profile Type with Profile2 module. Now I want to override it, importing three existing fields from my original Account (First Name, Last Name, Email) with their own values (that have already been set in the registration process).

I think I must try copying profile2.tpl.php on my theme page, but no changes seems to happen. Any idea about how to do it?


texts: How do you add a custom search box at code level?

texts:
I have a Drupal 6 site that runs Apache Solr. I need to programmatically add a search form to a custom block that is created by code.

Here is what I'm using:

  $form = array();

  $form['#action'] = 'sitesearch/';

  // search form
  $form['keys'] = array(
    '#title' => NULL,
    '#type' => 'textfield',
    '#value' => t('Search for questions and answers'),
  );

  // add in the click in erase routine
  $form['keys']['#attributes'] = array(
    'class' => 'NormalTextBox txtSearch',
    'onblur' => "if (this.value == '') {this.value = '" . $form['keys']['#value'] . "';} ;",
    'onfocus' => "if (this.value == '" . $form['keys']['#value'] . "') {this.value = '';} ;"
  );

  $form['submit'] = array(
    '#value' => t('Search'),
    '#type' => 'submit',
    '#attributes' => array('class' => 'filtered-search-form-submit'),
  );

  return $form;

When I submit the form I get to the search results page but it's blank, as if nothing was searched. Any ideas or guidance would be great.


texts: Can I migrate Drupal 6 to 7 by using Features 7 to import Features 6 code?

texts:
I am attempting to migrate Drupal 6 to Drupal 7 using the migrate_d2d_ui module, but the cck fields are not coming over correctly.

Can I use the Drupal 6 Features module to generate code which can be imported by the Drupal 7 Features module?

Thanks.


texts: How do I adjust the 'Create New Account' settings?

texts:
New registrations are asked to create a password which is, in my opinion, excessively strong. Where do I go to adjust the password strength and other 'new account' settings?  When I looked in the listed modules, the 'User Module' was greyed out.

I am using Drupal version 6.


texts: How to change composer file directory after it has been set?

texts:
So, I've been struggling with some problems with composer and drupal 7. I have composer and composer manager installed because of dependencies for the OpenLayers Module. I don't think I use these dependencies since the site works fine without them installed, but I've run into an issue where I need to fix a composer error in my production environment which is on a shared host and I can't install composer.
Most recently, I've just been trying to correctly install the dependencies and then move the files to my live server and hope everything works out. The issue is that when I moved the database to the development machine, the composer file directory is still set with the path from the live server. Anytime I try to navigate to Configuration => System => Composer Manager, or to Status Report, I get the following error:

RuntimeException: Error creating directory: /home/phislub9/public_html/sites/default/files/composer in composer_manager_file_dir() (line 299 of /var/www/html/psrlivetoupdate/sites/all/modules/composer_manager/composer_manager.module).

The issue is that this path is now effectively hard-coded, unless I alter it in the database. So, how can I fix this, and what the correct process for installing these dependencies.


texts: How to override other module function/hook from my custom module?

texts:
I'm currently working on a custom module which holds a list of organization IDs that will be used to match with an attribute I get from a SAML idP response.

I'm currently using the saml_sp SAML Service Provider module which has hooks/functions for finding the Drupal user and log it in, otherwise create a new user if none exists with that email.

I need to check if the org. ID matches any of the IDs in my custom module's table entries instead, so there's a substantial amount of modifications needed to change this workflow.

Preferably, I wish not to do any modifications to the saml_sp code as future updates of that module or fresh installations would cause havoc and the login won't work.

Is there a way to bypass saml_sp's hooks/functions so that my custom module can "take over" once the particular hook/function in saml_sp gets called?

There seems to be a lot of mixed opinions about this. Personally I don't see the point in not being able to do this, as the typical Drupal installation consist of an orgy of modules and they should all be able manipulate each other, right? Or am I missing another simpler solution to the problem?


texts: Page view to show nodes related through node reference

texts:
I am working in Drupal 7 and I have two content types: "member charity" and "member news story." "member news story" contains a "field_charity_reference" field (a node reference) that creates a reference between the news story and the member charity the story is about. I wish to set up a view that shows all the news stories for any charity. I have set up a page view with the path /our-members/news/%. I can set a relationship on "Content: Charity Reference" that filters only nodes with a charity reference.

How do I pass the charity name from the URL, so that only "member news story" nodes with a node reference to the charity name are returned?

Note: I have tried using "content: NID" as a contextual filter, setting the relationship to "field_charity_reference" and "When the filter value is not in the url" set to provide a default value, type Raw value from URL, path component 3 and ticking "use path alias." I have also tried the above using "Content: Charity Reference," but neither of these return any results when I go to /our-members/news/example-charity-name.


texts: CKEditor incompatible with 'limit HTML tags' text filter?

texts:
I'm using CKEditor Module 7.x-1.15 with CKEditor v4.4.4. This is applied to the Drupal 'Filtered HTML' text format.

I want to filter out
 tags, so have checked 'Limit allowed HTML tags' in the text format settings.

If I enter
test
 into the field, CKEditor converts this to &lt;div&gt;test&lt;/div&gt;. So upon save, the filter doesn't recognise the tag and
test
 still displays when viewing the node.

By default, CKEditor is escaping HTML entities.

In the CKEditor profile settings, there is an option to set HTML Entities to No but it seems to make no difference.

I was able to force config.basicEntities = FALSE; into the Custom JavaScript Configuration setting. But this seems to generate lots of extraneous
 tags.

Is it better to disable the core text format filter, and try using a CKEditor plugin to strip tags instead?


texts: How to show virtual node if there is no result in the views(date template) that use Contextual filters?


texts: Prevent items from being indexed so it won't come out on search

texts: Drupal 7 - Can you you exclude an entire content type (or just selected entries from it) from being indexed so they won't come up in a search result? I'm just assuming that indexing is the answer but the main point is that neither of the items will come up on a search result.


texts: Custom submit handler is also called when deleting a node

texts:
So these are my functions:

function mycustom_form_alter(&$form, &$form_state, $form_id) {
  $form['actions']['submit']['#submit'][] = 'b2share_form_submit';
  return $form;
}

I can also attach the custom submit handler in other ways to the form, but only this way I can still access the nid and the bundle of the node.

function b2share_form_submit($form, &$form_state, $entity_id, $entity_type) {
   $values = array(
   'url' => $form_state['values']['b2share_fieldset']['url'],
   'pid' => $form_state['values']['b2share_fieldset']['pid']
  );

  if ( (empty($values['url'] == false) || (empty($values['pid']) == false)) ) {

    $insert = db_insert('field_data_field_b2share')
      -> fields(array(
       'field_b2share_url' => $values['url'],
       'field_b2share_pid' => $values['pid'],
       'entity_id' => $form_state['node']->nid,
       'entity_type' => 'node',
       'bundle' => $form_state['node']->type,
       'delta' => 0,
       'language' => 'und',
    ))
   ->execute();
 }
}

I can add nodes and edit them perfectly, but whenever I try to delete one, the custom handler function is called and prevent drupal from doing anything. No error messages, nothing in the logs.

Can someone help?


texts: image_style_url no longer creates images

texts:
This started today on a website that has been running for over two months. I have a custom module that creates an image using the following code:

$image = image_style_url("catalogue_category_image_size", $product->field_product_image["und"][0]["uri"]);

This also did not work, but was the original code from earlier today:

$image = image_style_url("catalogue_category_image_size", $product->field_product_image["und"][0]["filename"]);

Here is the site, for reference: http://www.boudiccacollection.com/boudicca-catalog

I have no errors at all in the watchdog log or in apache logs. My status report page is green.

The only thing I would note is that the site was recently upgraded to drupal 7.23 from drupal 7.18

I have disabled clean url's to no avail.

EDIT I've added $conf['image_allow_insecure_derivatives'] = TRUE; to my settings.php and it did not correct the issue, however I now have error messages relating to 2 styles of one image (not all styles...)

Watchdog message:
     http://www.boudiccacollection.com/sites/default/files/styles/catalogue_category_image_size/public/BR004_WEB.jpg?itok=hetdMSsA
    http://www.boudiccacollection.com/boudicca-catalog
    Unable to generate the derived image located at public://styles/catalogue_category_image_size/public/BR004_WEB.jpg.

EDIT The same image is used in three places and works in one and not the other two.

Place 1 (broken):

URL: http://www.boudiccacollection.com/boudicca-catalog
Image: http://www.boudiccacollection.com/sites/default/files/styles/catalogue_category_image_size/public/BR004_WEB.jpg?itok=hetdMSsA

Place 2 (broken):

URL: http://www.boudiccacollection.com/boudicca-catalog
Image: http://www.boudiccacollection.com/sites/default/files/styles/catalogue_category_product_image_size/public/BR004_WEB.jpg?itok=SIXXe2Yq

Place 3 (works):

URL: http://www.boudiccacollection.com/br004-br004-four-corners-ring
Image: http://www.boudiccacollection.com/sites/default/files/styles/catalogue_product_image_size/public/BR004_WEB_0.jpg?itok=ZtLPZpD9

Place 3 has a different URL even though all of the code should be pulling the same image. Maybe this isn't an image_cache problem...


texts: Using composer - basics with localhost Mamp

texts:
My goal is to try updating drupal/core with Composer and to learn composer basics. Composer is installed on OS X. From terminal i can run

My-MacBook-Pro:~ osxuser$ composer
   ______
  / ____/___  ____ ___  ____  ____  ________  _____
 / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                    /_/
Composer version 1.4.1 2017-03-10 09:29:45

Usage:
command [options] [arguments]...

So how do I make composer find my drupal8 install in Mamp?

I have tried both:

composer -d, --working-dir=/Applications/MAMP/htdocs/test_d8

and

cd /Applications/MAMP/htdocs/test_d8

If I am running several drupal 8 installs in /Applications/MAMP/htdocs/ how do I tell composer witch one to work on?

From what I've red you don't need drush any more. I am not sure Composer has all it needs to work with Drupal 8 either.

composer show
symfony/css-selector      v3.2.6  Symfony CssSelector Component
symfony/dom-crawler       v2.8.13 Symfony DomCrawler Component
symfony/finder            v3.2.6  Symfony Finder Component
symfony/polyfill-mbstring v1.3.0  Symfony polyfill for the Mbstring extension

composer diagnose
Checking composer.json: WARNING
No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.
require.symfony/dom-crawler : exact version constraints (2.8.13) should be avoided if the package follows semantic versioning
Checking platform settings: WARNING
The OpenSSL library (0.9.8zc) used by PHP does not support TLSv1.2 or TLSv1.1.
If possible you should upgrade OpenSSL to version 1.0.1 or above.

Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Checking pubkeys:
Tags Public Key Fingerprint: ---numbers here---
Dev Public Key Fingerprint: ---numbers here---
OK
Checking composer version: OK

Can someone point me in the right direction here? Do I need to use/install other composer submodules/libraries?

Is it possible to do some sort of composer update drupal/core --dry-run as a test?


texts: Stuff added to  not included in cached version

texts:
I have a page on drupal 7 where I have the text format set to PHP Code.  I am using the drupal_add_html_head() to include a few CSS/JS files, and an RSS link.  My problem is that everything I add with drupal_add_html_head is only visible for a single view after the caches are cleared.  After that single view they do not show up in the view source.

It can be demonstrated with a Body that is as simple as below.  The first view will show an alert.  If you reload the page, the script is not added, and alert() is not called.

<?php
drupal_add_html_head(array(
  '#tag' => 'script',
  '#value' => 'alert("Hello world!");',
  '#attributes' => array(
    'type' => 'text/javascript'
  )
), 'jscripttest');
?>

You should see "Hello world!"  But you don't unless you have just
cleared the cache.

I have also tried drupal_add_css, and drupal_add_js with similar results.  The CSS/JS is displayed after the cache is cleared, but only once.


texts: How add menu to my node programmatically?

texts:
This is how i create my node :

    $value= array(
                'type' => 'page',
                'title'=>"First node",
                'body' => array(
                    'value' => "test",
                    'format' => 'full_html',
                ),
);

$nodeEntity=\Drupal::entityTypeManager()
            ->getStorage('node')
            ->create($value);

        $nodeEntity->save();

This work fine.

But i try to give a menu parent to this node.

i try that :

$value= array(
            'type' => 'page',
            'title'=>"First node",
            'body' => array(
                'value' => "test",
                'format' => 'full_html',
            ),
            'menu'=>array(
             'title'=>"First node",
             'menu_parent'=>6,
             'description' => '',
             'enabled'=>1

        ),

);

i set the field menu because it's the name of the field in the node edit form.
But for the nodeEntity, this field doesn't exist.

How can i give a parent menu id to my node ?

UPDATE

if i set menu_link instead of menu, i got no error i still can't see the menu on the node.


texts:
I am using drupal 7 with custom omega theme. I am developing a site for myself for a year now. I could find a solution to everything until now. Hopefully the answer is easy and simple I just don't see the wood from the tree.

How can I remove or hide the 'Do something on load' message, but keeping those messages what I want to appear?

Thank you for your time to read, and I'm hoping in a quick and good response

Thank you everyone who looked at it.
It seems I have found the answer.
Yes it really is connected to the Entity Reference field.
There is a sub-module called " Entity Reference Behavior Example".
All I needed to do is to disable this sub module.
I have fallen into that mistake to switch it on without knowing exactly what it is doing.
Simply switch it OFF.


texts:
I've been using this syntax for years for images in articles :

Now this Lightbox2 is gone in D8, what will be the equivalent code in D8 Colorbox?

The following code does not open Colorbox:

I've checked properly and Colorbox library is correctly installed. Though Iam unable to locate Colorbox JQuery library in page after disabling JS aggregation and clearing cache.


texts: Can't set view title in hook_views_views_pre_view

texts:
I am trying to change the title of the view based on some conditions view object. I figured that I could simply run

drupal_set_title('New title');

from inside the hook_views_views_pre_view, but its not changing the title. I tried it in hook_views_query_alter too, but it wouldn't change. I've confirmed that its actually entering the hook by doing a printout of the view object.

Should I be able to set the title from these hooks?


texts: Google Analytics Reports with Background Process module (non-blocking http request)

texts:
Using Google Analytics Reports module latest version 7.x-3.0-beta2. I wanted to make this module to make requests in non-blocking fashion. Standard drupal makes it blocking fashion, which slows things down.

I started looking into Background Process module, which looks promising. Other option is HTTPRL module, which is similar to Background Process.

Right now I am using AJAX for fetching GA API reporting data, but I feel it's slow, because of how drupal_http_request works (synchronous, blocking way).

Is it possible to integrate non-blocking requests to fetch data from GA API without rewriting excellent Google Analytics Reports module?


texts: What would the snippet(s) look like for multiple google analytics tracking IDs?

texts: I'd like to include 3 tracking IDs on all pages. I'm using the Google Analytics module and there are three fields in the custom javascript code under advanced settings.


texts: RSS item elements not being not being read by XML Reader

texts:
I am new to stackexchange and don't know if i am asking this correctly but plz help me.

I am using Drupal Views to display RSS for my site. I am using the 'Views RSS: Core Elements' module to map the RSS fields with the custom fields added by me in the views. All works well. But a requirement forces me to add custom item elements in the RSS display. I am implementing the hook_views_rss_item_elements() to add custom item elements. When i view the RSS page i get the see the custom items but when i try to read the RSS using a RSS reader, the items are not being read. What am i doing wrong, or am i missing something?

Here is my code to add custom items to the 'SHOW ITEM ELEMENTS : CORE' for RSS display:

function Mymodule_views_rss_item_elements() {
  $elements['blogs_title_image'] = array (
    'title' => t('Blogs Title Image'),
    'description' => t('Blogs Title Image'),
  );
  $elements['blogs_additional_tags'] = array (
    'title' => t('Blogs Additional Tags'),
    'description' => t('Blogs Additional Tags'),
  );
  $elements['blogs_short_desc'] = array (
    'title' => t('Blogs Short Description'),
    'description' => t('Blogs Short Description'),
  );

  return $elements;
}


texts: How to put two cck fields in add content page in drupal 6

texts:
0 down vote favorite

I have created a content type in Drupal 6.

I want to add an input field to a number and a select(dropdown) field to get Year/months. They should be next to each other in add content page.

User enters for example 3 months by typing 3 in text input and select months from dropdown. But I don't know can I do it in Druapl 6 using CCK.

If I add two fields they will be shown with their label but I want they be next to each other without any label between them.

How can I do it?


texts: How to remove a stylesheet provided by a contrib module?

texts:
The new version of Field Group has a new stylesheet included by default that makes my theme look hideous.  Deleting the stylesheet from the module's folder fixes the problem but then I will have to delete it again when Field Group is updated again.

What's the right way (= not modifying the module's code directly) to do this?


texts:
I have hook_menu() configured to show a tab for every node at node/%node/summary.  The callback for that page returns the correct content, but I'd like to add a bunch of HTML to the page.

I believe I need to create a .tpl.php file in my custom theme.  How do I know what to name the file and make sure that the template is used only on the correct pages?


texts: installed memcache, no noticeable improvements

texts:
I just installed varnish and memcache on my server. Varnish works great but I don't really know how memcache should perform. I can't see any improvements for authenticated users.

I turned on memcache statistics and saw that it is working but I can't see a noticeable improvements in the page loading time.

Any ideas on how I can improve performance for authenticated users for an existing website?

Thanks, M.


texts: Can I have multiple nested forms within the same fieldset?

texts:
I am building a custom module that adds a form to certain node types that allows the user to fill/save some additional information about the node.

I would like to have 2 buttons. 1 which saves the data entered (currently working) and another which posts the data to an external script.

I can get this working by creating two different forms and settings their #action's accordingly but I would like the form markup all in a single fieldset, is this possible?


texts: How to apply the page-hiding snippet for Google Optimize?

texts:
I'm trying to use Google Optimize on a Drupal 8 site through Google Tag Manager.  I have set up the tags in Google Tag Manager through Google's UI and used the Google Tag Manager module to add the snippets to my site on path /test/*.

However, according to the Google Optimize documentation, I should also add a "page-hiding snippet":

<HEAD>
<!-- Page hiding snippet (recommended)  -->
<style>.async-hide { opacity: 0 !important} </style>
<script>(function(a,s,y,n,c,h,i,d,e){s.className+=' '+y;h.start=1*new Date;
h.end=i=function(){s.className=s.className.replace(RegExp(' ?'+y),'')};
(a[n]=a[n]||[]).hide=h;setTimeout(function(){i();h.end=null},c);h.timeout=c;
})(window,document.documentElement,'async-hide','dataLayer',4000,
{'GTM-XXXXXX':true});</script>

There are three requirements here.

The snippet needs to come before the Google Tag Manager tag in the HEAD of the page.
The snippet should only be shown on pages with path /test/*
Inside the snippet, the GTM-XXXXXX needs to be different for dev/staging/live environments.

Is there a way to standard way to set this up?  I assumed that Google Optimize/Analytics is popular enough there would be some information for integrating it with Drupal, but all I found was this DrupalCon 2019 seminar that hasn't happened yet.

Setting up Google Tag Manager was fine, but I'm lost at how to get this final bit in the right place.


texts: 'Edit Own Content' permission missing in custom entity

texts:
I have generated a custom entity using Drupal Console.

drupal generate:entity:content

The entity doesn't have the permission edit own content which we usually have in node types etc... The entities entity_name.permissions.yml the file has the following enteries.

add company entities:
  title: 'Create new Company entities'

administer company entities:
  title: 'Administer Company entities'
  description: 'Allow to access the administration form to configure Company entities.'
  restrict access: true

delete company entities:
  title: 'Delete Company entities'

edit company entities:
  title: 'Edit Company entities'

access company overview:
  title: 'Access the Company overview page'

view published company entities:
  title: 'View published Company entities'

view unpublished company entities:
  title: 'View unpublished Company entities'

I tried understanding, how this is done in node. But in node types permission file also I couldn't find this permission entered.


texts: FieldException Error field_update_field() cannot change field's type

texts:
I've got a very strange error and I was hoping someone might be able to help. I'm working on a D7 site (using the latest Acquia version) and it looks like for some reason there is a problem with fields that I cannot isolate.

I'm not sure why this error is being fired - I had a crash because of a problem on the Media Temple side of things earlier, and I had to go back in and manually enable all kinds of modules again.

I've installed D7 Acquia distribution again, and removed anything that might have been corrupted in the files from the crash, but it persists. THis is a core module, so I'm not sure where to begin

FieldException: Cannot change an existing field's type. in field_update_field() (line 234 of /var/www/vhosts/.../modules/field/field.crud.inc).

I can't tell if this was something due to the crash at Media TEmple, or if has something to do with a conflicting module, or what. If anyone has any ideas, I'd be grateful for the help!


texts:
i trying to make the search on drupal show result by date. for example if i type 25/05/2010 it should return posts for that date and also search by key work which is default on the search. how can i acheive that.

function mytheme_preprocess_search_result(&$variables) {
    $result_node = $variables['result']['node'];
    $image_realpath="";
    if(!empty($result_node->field_op_main_image)){
        $image_field = $result_node->field_op_main_image;
        $image_realpath = file_create_url($image_field['und']['0']['uri']);
    }
    $variables['image_uri'] = $image_realpath;
    $author_name="";
    $info = "";
    if(!empty($result_node->field_op_author)){
        $author = $result_node->field_op_author;
        $lang = $result_node->language;
        $author_id = $author[$lang]['0']['nid'];
        $author_detail = node_load($author_id);
        $author_name = $author_detail->title;
        $info .= $author_name . ' - ';
    }
    if(!empty($result_node->field_date)){
        $date_obj = $result_node->field_date;
        $date_val = $date_obj['und']['0']['value'];
        $info .= date('d/m/Y', strtotime($date_val));
    }
    $variables['info'] = $info;
    // dpm($variables);

above is the code for displaying my result for now.

please help thanks

=======================================================================

EDITED

so this is what i got so far: let me try to explain:

i was trying to modify the search-form and the search-block-form i was able to add a jquery date picker so that the user might search for a specific date or a key word.

the date picker is working

now the issue is:

when i search for key words and press submit it return the article with key word. but if i enter date only it give error to enter keyword and if i enter keyword and date it search by keyword only and ignore the date

code is below

// function to modify search form
function fiveplus_form_alter(&$form, &$form_state, $form_id) {

// $variables['form']['actions']['submit']['#value'] = 'search';
if((array_key_exists('#id', $form) && $form['#id'] == 'search-block-form')){
    $form['actions']['submit']['#value'] = '';
}
if((array_key_exists('#id', $form) && $form['#id'] == 'search-form')){

    $form['basic']['submit']['#value'] = 'submit';
    $form['basic']['keys']['date_field']['#title'] = 'search';
    $form['basic']['date_field'] = array('#type' => 'date_popup','#date_format' => 'Y-m-d');
    dpm($form_state);
    //$form['advanced'] ;
}

so anyone can help me figure out how to make a user be able to search only by 1. date 2. date and keyword 3. keyword

thank you


texts:
Would it be best to create my own form or use contrib. drupal7 modules to complete my following need. If i use contrib. modules, which ones should i use.

I want to make a form that has 3 fields. 2 autofill and 1 auto complete. One of the autofill fields would just autofill the current users 'first and last name.' The auto complete field will auto complete existing users in the site - so if you begin to type in a users name it will auto complete for you. The other autofill field will autofill the autocompleted user's supervisor.

Spent a bunch of time trying to configure webforms or entityforms, then kinda wondered if this should just be done with an in house custom form. Whats the best Drupal7 practice for this?

At the end it will email 3 people and then be put into some review process. The 3 people will be the autocompleted user, the autofilled supervisor and a static HR email address. I suppose i would bake that all in a submit handler, if i did my own custom form.


texts: How do I programmatically render a menu's label?

texts:
I'm trying to render out a menu with its label in Drupal 8. I am able to get the menu and its links inside of a preprocess function using a helper function, but I can't locate the menu's title.

Here is how I'm getting the menu. I'm able to add the return value as a twig variable $variable['menu']['menu-name'] and render out an <ul> anywhere I need to.

function get_menu($menu_name) {
  $menu_tree = \Drupal::menuTree();
  $parameters = $menu_tree->getCurrentRouteMenuTreeParameters($menu_name);
  $tree = $menu_tree->load($menu_name, $parameters);
  $manipulators = array(
    // Only show links that are accessible for the current user.
    array('callable' => 'menu.default_tree_manipulators:checkAccess'),
    // Use the default sorting of menu links.
    array('callable' => 'menu.default_tree_manipulators:generateIndexAndSort'),
  );
  $tree = $menu_tree->transform($tree, $manipulators);
  $menu = $menu_tree->build($tree);

  return array('#markup' => drupal_render($menu));
}


texts: how can i remove 'create new account tab ' from login page and show 'access denied' for 'user/register' in drupal  6?

texts:
i have two roles in my sites and i have created a separate user registration pages for both roles with different urls.Now i want to remove the "create new account" tab in login page and
i want to show "access denied" message for user who try to visit "user/register" page.i am working in Drupal 6.

I removed the 'create new account tab' in theme layer and if user try to access "user/register" means, it shows the default registration page. i want to show access denied message instead showing default registration page. is there any another method or any module for this? how can i implement it?


texts: Why would piece of content of each content type be migrated but their text formats wrong?

texts:
I'm trying to migrate content D6 -> D7. I've written the importers (actually just edited existing ones) and run the process. However, as far as I can see, body of content are imported but with the wrong format i.e. one of them correctly shows as Full HTML while another shows just Select.

Below is my importer:

class StoryMigration extends NodeMigration {
  public function __construct(array $arguments) {
    parent::__construct($arguments);
    $this->addFieldMapping('title', 'title');
    $this->addFieldMapping('body', 'body');
    $this->addFieldMapping('taxonomy_tags_1', 'field_tags')
      ->defaultValue('tid');
    $this->addFieldMapping('field_headerimage', 'field_headerimage')
      ->sourceMigration('Files');
    $this->addFieldMapping('field_headerimage:file_class')
      ->defaultValue('MigrateFileFid');
  }
}

UPDATE: I also did a format mapping, like below:

$common_arguments = array(
    'source_connection' => 'default',
    'source_version' => 6,
    'format_mappings' => array(
      '1' => 'filtered_html',
      '2' => 'full_html',
      '3' => 'php_code'
    ),
   ...
   ...
   ...
  );


texts: Clean URLs not working, I can't log in to Admin Panel

texts:
I just moved my drupal website to another host. But I am unable to login as mysite.com/user. It gives me a 404 not found error which means clean urls are not working afaik.

So, I checked PHP configuration with phpinfo(); and there is "mod_rewrite" visible in "loaded modules" section.

Anyway, I wanted to disable clean urls, however if I try to login as mysite.com/?q=user, it redirects to mysite.com/user and it is giving 404 not found error again.

So I kinda have no way to login to my website to update URL aliases. I have renamed my .htaccess file to disable it, result did not change.

I have updated this line:

  RewriteRule ^ index.php [L]

to this line:

  # RewriteRule ^ index.php [L]
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

Still, nothing changes. Since I can't control the web server, all I have is FTP and MySQL. Any ideas?


texts: Registration form to be submitted via ajax

texts: I want to submit drupal'S registration form to be submitted via ajax .How can I acomplish this???


texts: How to boostrap Drush from within an update hook?

texts:
I have a drush command I am using to convert field_collection to multifield.

/**
 * Convert Field Collection to Multifield.
 */
function mvpd_update_7018() {
  module_load_include('inc', 'multifield', 'multifield.drush');
  $field_collections = array(
    'field_brand_app_logos',
    'field_brand_resource',
    'field_mvpd_app_logos',
    'field_mvpd_authz_messages',
  );
  foreach($field_collections as $field_collection) {
    drush_multifield_convert_field_collection($field_collection);
  }
}

I get the error:

'call_user_func_array() expects parameter 1 to be a valid callback, function 'drush_update_do_one' not found or invalid function name batch.inc:163'.

drush_update_do_one exists in /home/elijah/.composer/vendor/drush/drush/commands/core/drupal/update.inc and isn't really in module_load_include()'s scope of responsibility.

What is the best way to boostrap Drush to have it run in an update function?


texts: Adding CSS in both custom theme and admin theme

texts:
How to modify some css to a tapir_table display being used in both places:
in my custom theme and administration theme

Specifically, i would like to make the qty and sku columns displayed on both my_website.local/user/1/orders/2 and my_website.local/admin/store/orders/2 align to the left, instead of center (the way ubercart's uc_order.css has it).

In my custom theme, it was as easy as modifying the style.css file and adding this css:

.order-pane-table td.qty, .order-pane-table td.sku {
  text-align: left !important;
}

but i was wondering if there is a way to do the same for the administration display without modifying the admin theme or create a sub-theme of that admin theme.


texts: My module development snapshot is never updated

texts:
I made some changes to my module on Drupal.org and pushed them up; I have seen that Drupal.org updated the development snapshot. Shortly after, I made some more changes and pushed them up, but this time it has not been updated.

I do see my commit when I look at View commits.

I was told that Drupal.org updates the development snapshots every 12 hours; but it has been already 24 hours since the last git push I did.

git push origin 7.x-1.x
Everything up-to-date


texts: How to implement custom theme functions (theme_textfield, theme_form_element) for some forms only?

texts:
How to implement custom theme functions like theme_textfield or theme_form_element?

I know we can do it using hook_theme_registry_alter:

/**
 * Implements hook_theme_registry_alter().
 */
function krown_admin_theme_registry_alter(&$theme_registry) {

  //Override some Drupal defaul theme functions

  $theme_registry['textfield']['theme path'] = drupal_get_path('module', 'krown_admin');
  $theme_registry['textfield']['function'] = 'krown_admin_theme_textfield';
  $theme_registry['textarea']['theme path'] = drupal_get_path('module', 'krown_admin');
  $theme_registry['textarea']['function'] = 'krown_admin_theme_textarea';
  $theme_registry['form_element']['theme path'] = drupal_get_path('module', 'krown_admin');
  $theme_registry['form_element']['function'] = 'krown_admin_theme_form_element';
  $theme_registry['form_element_label']['theme path'] = drupal_get_path('module', 'krown_admin');
  $theme_registry['form_element_label']['function'] = 'krown_admin_theme_form_element_label';

}

The problem with this approach, is that the custom functions are applied on all website. I just want to apply them for some forms or for a specific theme.


texts: Customizing menu link output (add badge)

texts:
I am new to drupal. I want to customize menu link

Top

All Posts

Discussed

to

Top

All Posts42

Discussed

Just add 42 next to "All Post" menu link.


texts:
I want to scrape a news sites with Feeds Xpath Parser. The news site is very basic, it has 10 ~ 15 titles, and below those titles a little block of text.

How can I loop through all the titles and blocks of text and have nodes created? Also it has to check every 30 mins for new articles, and if there are it should add them.

Any help will be greatly appreciated.

//W


texts:
I want to create an entirely new website within a drupal7 website.
 For example:
www.school.edu will have theme A (not sure if theme's the right word, basically, different looking webpage). And all its subpages and paths will have the same thing. (i.e. www.school.edu/news, wwww.school.edu/about, www.school.edu/contact ... etc).
 And, I want a new website within www.school.edu to exist. And that new website should have a different theme.

 for example:
www.school.edu/compsci will have theme B. And all the subpages that follows under compsci/ should all have the same themes; by having a different theme, I mean they will have different headers, different logos, different main menus, different everything, basically entirely new website. (i.e. www.school.edu/compsci/news, www.school.edu/compsci/about, www.school.edu/compsci/contact

I have looked around for answers; it's just that I haven't been able to phrase my question well and I thought if I explained it as such, I would be able to get more accurate answers.

With the code below, I have been able to make each subpage that exist under /compsci to go to page__layout_1 ...

function theme_preprocess_page(&$vars, $hook) {
    $path = drupal_get_path_alias($_GET['q']);
    $current_page_path = explode('/', request_path());

    if ($current_page_path[0] == 'compsci') {
      $vars['theme_hook_suggestions'][] = 'page__layout_1';
    }
}

Now, the question is, how I would be able to define different main-menus, different nav-bars, so on. I am quite new to drupal so some terms I am still unfamiliar with -- do I create custom themes or custom modules -- what's the best approach to this?


texts: How can I better protect access to all site reports except 'Recent log messages' based on role?

texts:
How can I better protect access to all site reports within /admin/reports/ (except for Recent log messages)? I know I can hide it through CSS or disable the menu in management menu, but is there a better way to disable it?

I have these role defined (apart from Anonymous and Authenticated):

System Developer (can view all reports).
Admin (can only view 'Recent log messages').

Is there any Drupal function or hook that I can use to reach my goal?


texts: Mini pager on View in a block does not work

texts:
I have a view that is displayed on a rightside block using quicktabs.

In Quicktabs it is the third option and set up as a view (as opposed to set up as a block).

It lists authors on a blog, and has a pagination feature. The mini pagination DOES show up, it just doesn't do anything. The pagination link appears but doesn't actually effect the view in the quicktab.

I've tried changing the Views ajax feature both on and off and neither have an effect.


texts:
I'm looking at building a Web Application on the Drupal framework. Does anyone know of an existing drupal profile installation that has this viewpoint?

For example, I've been building features for Open Atrium and I'm familiar with some of the concepts and modules this contains. However, Open Atrium does not really satisfy the concept of clients having a profile and creating projects with subscriptions.

So in essence, I'm looking for a package similar to Open Atrium, but satisfies a web application development. Think of it more as building web tools like Basecamp or Freebooks, but using a base platform to get there.

Any ideas?


texts: Rules won't let me change some node properties

texts:
I am trying to create a new rules component (action set) for publishing content that has been unpublished and I cant seem to set a few of the node properties. I will either use Flag or Rules Link to fire off the action set.

The main goal of changing these values is to basically reset the node as if it was just created, without having to make a new node and copy the field data over to the new node.

A node should become unpublished then when it is made published again, it should behave if it was a new node that was just saved. Created date is set to "now". Marked as "is-new", etc...

I can't change the node:is-new setting to mark it as new content again.
I also can't change the node:created or node:updated properties to change the date it was either created or updated. I just get a error that says "The selected data property doesn't support writing."

Any thoughts or work arounds for this?


texts: Captcha is not working as expected.Visible on webform when logged out and invisible when logged in

texts:
I have not selected any of the options:

Default challenge on non-listed forms.
Add CAPTCHA administration links to forms
Allow CAPTCHAs and CAPTCHA administration links on administrative pages

I have selected persistence:
Omit challenges in a multi-step/preview workflow once the user successfully responds to a challenge.


texts: How can I add player parameters to a core oembed field for a youtube video?

texts:
For example, if I enter this url that contains the player parameters to remove controls and autoplay, oembed field on my media type does not allow it ("The given URL does not match any known oEmbed providers.".
https://youtu.be/9ot0rIlhbNE?autoplay=1&fs=0&controls=0&modestbranding=1

If I paste just the base url, then it works.
Any thoughts?
Edit: Based on Yuseferi answer, I have isolated the Youtube section if the providers.json.
{
    "provider_name": "YouTube",
    "provider_url": "https:\/\/www.youtube.com\/",
    "endpoints": [
        {
            "schemes": [
                "https:\/\/*.youtube.com\/watch*",
                "https:\/\/*.youtube.com\/v\/*",
                "https:\/\/youtu.be\/*"
            ],
            "url": "https:\/\/www.youtube.com\/oembed",
            "discovery": true
        }
    ]
}


texts:
I've got a website where people vote on a user using a button found on the user's profile page, and where users are ranked on the homepage based on the number of votes to their name (along with some fields associated with their account).

I'm trying to implement this voting system using another module (because the voting API isn't particularly well documented). Unfortunately, the Rate module is only suitable for nodes and comments, and the Fivestar module is not suitable for this purpose (I just need a single vote button).

I've also tried adapting the Flag module, although this is proving to be difficult, because I need the ability for users to vote a maximum of once per week on a profile, and by default, it does not allow this.

I'm using Drupal 7, and I have access to cron jobs and full control of the drupal installation.

I'd be grateful if anyone who has experience with the voting API, or a different module could direct me on how to set up this system.


texts: Create Content pane with contextual filter

texts: I am trying to get a Content Pane on a view working with using a contextual filter in a view. The view will only filter based on the URL if I use "Term Name converted to Term ID".  I am unable to use either Term Name or Term ID by itself.


texts:
I implemented fboauth module. It works fine and I can to link my site's account with facebook account.

I need if user logged in and his account is linked with facebook, show his picture at some block, else don't show picture or show some other picture.

Can you help me?


texts:
I don't know why this is happening, but none of my content are displayed when logged out. All the content in views, blocks, everything disappear upon logout. As far as I can remember, I haven't touched any permission. In fact I created this project only a few days ago.

I have two jCarousel slideshows and a few views connected with nodequeues on my site among other things; all of them disappear upon logging out. I have already checked all permissions on views, blocks, and everything I could find.

What can I do to resolve the issue?

As an experiment I searched for a content through the search bar, and the page returned said access denied.

EDIT: Problem solved. The solution has been posted in this thread.


texts: Drupal confusion when including multiple instances of same webform on a page

texts:
I have nearly the same problem than this : Multiple forms on single page?

But the answer  is for an inclusion on a page template and I want to do the same on a node template where I can't use any incremental ID loop. I'm using Drupal 7.


texts: how to add "create node form" in a block?

texts:
I just wanted to know how to add "create node form" in a block

when i  copy the source code and make a block out of that code, only public could post from that.
when i am posting as a user it says timeout and tells us to refresh the page.
plz someone give me solution.

SO i tried to add the following code in page.tpl.php

$form = node_add('nodetype');
print drupal_render($form);


texts: term reference field with empty select list

texts:
We need to make the term reference field select list to have no options because the vocabulary have big number of terms which makes the form loads very slow due to getting the term list from DB and render them.

That field is being updated by ajax so we need it start clean with no DB operation to increase performance and page loads fast.

  Implementing: hook_field_attach_form or hook_form_alter

has no effect as we see the form is built.

what we need i to prevent DB reading list.

if($form_id == 'field_ui_field_edit_form'){
      $form['instance']['default_value_widget']['field_brand']['und']['#options'] = array(0 => t('No'));
}

Above code didn't change any thing in node/add form which still list all brands

Is it posible in drupal?


texts:
How do I change a value, in this case the title field of a node object form, in the preprocess function of the form_alter hook.

$form['actions']['publish']['#submit'][] = MODULE_submit_preprocess';

function MODULE_submit_preprocess($form, FormStateInterface $form_state) {

   $form_state->setValue('title', 'Updated Title'); //not working...

   $fstate = $form_state->getFormObject()->getEntity();
   dsm($fstate);
}

dsm result

stdClass Object
(
    [__CLASS__] => Drupal\node\Entity\Node
    [in_preview] =>
    [values] => Array
        (
            [title] => Array
              (
                  [x-default] => Array
                    (
                         [0] => Array
                          (
                             [value] => Old Title


texts:
I am getting a variety of errors when I try to use Drush and nothing seems to be working. I am able to run drush and see the help commands indicating that I have it installed; otherwise, I can't get anything to work. I get the following error when trying to update a module as an example:

  Command pm-update needs a higher bootstrap level to run - you will need invoke drush from a more functional Drupal environment to run this command.
  Command pm-update needs the following modules installed/enabled to run: update.
  The drush command 'pm-update insert' could not be executed.
  A Drupal installation directory could not be found

When I check the drush status output, I get the following, but it doesn't appear to have any of the other relevant site info that is shown in other examples (e.g. theme name, site name, etc.).

 PHP configuration     :  /etc/php.ini
 Drush version         :  4.5
 Drush configuration   :
 Drush alias files     :

Drush is currently installed in my home directory on a BlueHost shared account and my primary site is in the public_html directory; I have an additional site with a separate Drupal version and separate database in a subdirectory.


texts: views 2 - how to fetch filepath of image field for output rewriting

texts: I'm in Drupal 6/views 2 and am rewriting the output of an image field. Is there a way to fetch the filepath of the image for the output? I have tried the filepath token for the image field, but the src for the image is not rendering, just the argument. Should I be using a preprocessor hook in a template file to do this instead?


texts: How to pass variables to overridden Twig template located in module?

texts:
I'd like to pass a variable to an overridden Twig template that is located in my custom module (not in a theme).

Following this answer and this answer, I wrote this code in mymodule.module:

function mymodule_preprocess_page(array &$variables) {
  $variables['hello'] = 'world';
}

function mymodule_theme_suggestions_node_add_list(array $variables) {
  $suggestions = [];
  $suggestions[] = 'node_add_list__' . 'custom';
  return $suggestions;
}

function mymodule_theme() {
  return [
    'node_add_list__custom' => [
      'base hook' => 'node_add_list',
    ],
  ];
}

Then, I have added in mymodule/templates/node-add-list--custom.html.twig:

myvar: {{ hello }}

However nothing appears after "myvar: " when I refresh the page. I mention that I cleared the cache.

Is there something specific to manage when we use hook_preprocess_page() with hook_theme_suggestions_HOOK()/hook_theme()?


texts: Is it possible to have pre-load elements in webforms?

texts: I have to add two elements (checkbox, texfield) in the creation process of the webform. This is because I want a simple terms and conditions inside all webforms. How can I do this?


texts: subject and body of mail messages empty using drupal 8 mail api - hook_mail

texts:
I'm trying to send messages using Drupal 8's Mail API, but the messages always have an empty subject and body.  Do you see anything wrong with the code?

In my module file:

function mymodule_mail($key, &$message, $params) {
    $options = array(
        'langcode' => 'en'
    );

    switch ($key) {
      case 'contact':
        $from = \Drupal::config('system.site')->get('mail');  //I'm not sure this is actually doing anything.
        $message['subject'] = 'Inquiry from Web Site';
        $message['body'][] = 'TEST BODY';
        break;
}

And within the submit method of my form:

 $langcode = 'en';
 $to = 'my@email.com';

 $mailManager = \Drupal::service('plugin.manager.mail');
 $module = 'mymodule';
 $key = 'contact';

 $send = true;
 $result = $mailManager->mail($module, $key, $to, $langcode, $params, NULL, $send);

I am getting the messages - and they are coming from the right email address (which may just be the default).  But the subject and body are empty and I can't figure out why.  Any suggestions would be appreciated!


texts: How do I give a user limited access to theme settings?

texts: I am interested in giving the site administrator some limited access over the appearance. Currently I can give them access to administer themes or not to, and nothing more granular than that. I would like, for instance to limit the themes they can enable and disable to a small number, and perhaps also limit what, within the settings they can change.


texts:
I am working on a site, and I want to integrate my site with an external site; for that, I need to use web services to get data from the external server. I don't know the technology used by the server.

I have to work as client. Can any one please tell me hoe to call web services from my site? Please write any code if it is required. Will drupal_http_request() help me?

I am using Drupal 6.


texts:
I migrated my site from lower version of drupal, during migration process the machine name of my vocabularies was changed, now I want to modify them manually, but I cant find the proper table in database. now the question is :

  How can I edit vocabularies machine name manually?


texts: create drupal 7 webform programmatically?

texts:
I have already created a webform and I need to fill it programatically.

how can I create webform ? Can i create it like node creation:

$node = new stdClass()
$node->type = 'webform'
$node->webform['components'][1]['value'] =  'sss'


texts:
I'm trying to create a pretty straightforward page with a Google map that I need to customize, but the code in the behavior isn't being run for some reason. Here's the code:

/**
 * Implementation of hook_theme
 */
function mymodule_theme() {
  return array(
    'affiliates_map' => array(
      'template' => 'affiliates-map',
      'path' => drupal_get_path('module', 'mymodule') . '/templates',
      'render element' => 'content',
     )
  );
}

/*
 * Page callback for map page.
 */
function mymodule_search_map() {
  drupal_add_css('
      html, body {
        height: 100%;
        margin: 0;
        padding: 0;
      }
      #map {
        height: 100%;
      }', array('group' => CSS_DEFAULT, 'type' => 'inline'));

  $path = drupal_get_path('module', 'mymodule');
  $gmap_api_key = variable_get('affiliates_gmap_api_key', '');
  drupal_add_js('//maps.google.com/maps/api/js?v=3&key=' . $gmap_api_key . '&callback=initMap',  array('type' => 'external'));
  drupal_add_js($path . '/js/mymodule.js', array('type' => 'file', 'weight' => 6, 'scope' => 'footer'));

  $output = theme('affiliates_map');

  return $output;
}

Here's my theme template.

<?php
/**
 * @file
 *   This template handles the display of the affiliates map.
 */
?>

Map content goes here

and the js file

(function($) {
  Drupal.behaviors.affiliatesMap = {
    attach: function (context, settings) {
      var map;

      function initMap() {
        map = new google.maps.Map(document.getElementById('naa-map'), {
          center: {lat: -34.397, lng: 150.644},
          zoom: 14
        });
      }
    }
  };
}(jQuery));

My console is giving me an error about initMap() not being found, and when I put a breakpoint in the behavior in initMap, it doesn't get hit. What am I doing wrong that it's not finding the behavior code? I've mimicked the Location Map module, and it works fine, so I'm not sure where I went wrong.

Thanks.


texts: Elysia cron module does not execute cron job automatically

texts:
I have installed the elysia cron module and setup the cron job. My module has a cron function test_cron() which inserts some data into a table.

This function lists in the elysia cron status page. I have setup the the default scheduled rule to */1 * * * * to run the cron after every minute.

When I click on the run infront of the test_cron() the cron runs and some data inserts into the database.

But this the manual method, I want to execute the cron after every minute therefore I defined the scheduled time for the test_cron(),  but it does not executed automatically after every minute.

What should I do? Is there any other configuration which I should do to run the cron automatically?


texts:
There's a huge security leak in <7.32. So I want to upgrade all my Drupal sites asap without too much worrying about breaking stuff.

But...

$ drush dl drupal-7.32
It's forbidden to download drupal core into an existing core.

This one works:

$ drush up

But that's not what I want now.

How can I only upgrade core to latest version?

drush up drupal is not sufficient on its own:
(Sorry about the Dutch. You'll get the gist.)

$ drush up drupal
Controle of updategegevens beschikbaar zijn ...                                                            [ok]
Update information last refreshed: di, 10/14/2014 - 20:57

Update status information on all installed and enabled Drupal projects:
 Naam                               Geïnstalleer  Proposed     Status
                                    de versie     version
 Administration menu (admin_menu)   7.x-3.0-rc4   7.x-3.0-rc4  Actueel
 Drupal                             7.31          7.31         Actueel
 Chaos tools (ctools)               7.x-1.4       7.x-1.4      Actueel
 Service links (service_links)      7.x-2.2       7.x-2.2      Actueel
 Entity API (entity)                7.x-1.5       7.x-1.5      Actueel
 Google Analytics                   7.x-2.0       7.x-2.0      Actueel
 (google_analytics)
 Localization update (l10n_update)  7.x-1.0       7.x-1.0      Actueel
 Module filter (module_filter)      7.x-1.8       7.x-1.8      Actueel
 Pathauto (pathauto)                7.x-1.2       7.x-1.2      Actueel
 Redirect (redirect)                7.x-1.0-rc1   7.x-1.0-rc1  Actueel
 Token (token)                      7.x-1.5       7.x-1.5      Actueel
 Views (views)                      7.x-3.8       7.x-3.8      Actueel
 Webform (webform)                  7.x-3.20      7.x-3.21     Nieuwe versie beschikbaar

No code updates available.


texts: Problem with Aggregate CSS files option and tmp directory

texts:
This issue has been asked at lots of places and posts, but none of the solutions I found helped me.

I moved a dev site to a server where it is going to go live. Right away I was puzzled why I had to manually create a tmp directory at the site root to get it working at all.

On the dev site, I had been running with the Temporary directory set to /tmp (note the leading slash), but on the new hosting the site forces me to remove the slash, complaining about SAFE_MODE.

The main problem though is that - even though the tmp directory is there and is writeable - turning on the Aggregate and compress CSS files. option causes the site to go into plain, no-stylesheet mode. The Aggregate JavaScript files. companion works just fine on the other hand.

I made sure the encoding of the CSS files is UTF-8 without BOM, as one of the posts suggested. Still - no go. Does anybody have a clue?


texts: When do hook_views_data() and hook_views_data_alter() get called?

texts: I'm working on a site I inherited that has a functioning hook_views_data_alter() implementation. I can see things in the Views editor that it has added. However, I cannot figure out how on earth to get that function to be called again so I can change the data. I am running xdebug with a breakpoint in the function body, and nothing I do, from editing a view, to adding a relationship, to clearing the cache or rebuilding the registry, trips that breakpoint. Not even putting module_invoke_all('views_data_alter'); in index.php. What do I need to do to get Drupal to run that hook again?


texts: AJAX Throbber - Keep throbber image but delete Please wait... message?

texts:
This question has been asked a few times in various forms but is there a simple way to keep the animated blue throbbing image but delete the Please wait... text?

I'm trying this in my form_alter hook:

unset($form['my-model']['#ajax']['progress']['message']);
// or
$form['my-model']['#ajax']['progress']['message'] = '';

But this appears to remove the message AND the animated throbber! I want the throbber to remain. Is it a requirement for message to not be empty for the throbber to even render?


texts:
I installed Drupal 8 and amptheme. I downloaded the AMP module and the library files. When I tried to install the module, I got the following message:

  The AMP module requires the PHP AMP library.

The library files are in libraries/amp-library. I think the library location is incorrect.

How do I fix the error?


texts: Error while saving a new node of a speific content type

texts:
my question is..

I have a business listing content type in my website. When i am creating a new listing i can not save it. It shows error message " Error
The website encountered an unexpected error. Please try again later. "

but when i am editing a old listing, i am able to save it.

Also i am able to create and save nodes of other content types like articles etc.

i am having this problem recently. Previously i was able to add them.

I have absolutely no idea what is causing this and how to solve this.

-----
Drupal 7.28
Voting, Fivestar rating and other usual modules


texts:
Is there anybody have ever used a  moudle that like File Repository ? Who can tell me whether have the similar module in Drupal.org ?

This module should provide these following functions :

(1) Authorised user can create folder and sub folder, upload files into a folder.

(2) Role-based access control:
      a) Authorised user can config the attributes of folder, can assign which role can access this folder.
      b)Folder & sub folder both can set different access control attributes.


texts: Can i populate the empty sites/default/files/ with files from a local installation?

texts:
There are no JavaScript and CSS files in the following folders:

/home/vhost/WWW/mysite.com/sites/default/files/js
/home/vhost/WWW/mysite.com/sites/default/files/css

All the folders are empty. Can i populate the folders with aggregated css and js files from another drupal installation that is the same?

Update: thx to googletorps and sheenas ideas and hints regarding the special constitution of the aggregated css and js-files i just have had a closer look at them - which are based on my local (!!!) installation of the exacly same installation - a drupal commons: for the sake of a better understanding the aggregation of the hashed files i add the output of the shell here:

we see the files how the should (!!!) look like:

here we see the css-files

linux-vi17:/srv/www/htdocs/com624/sites/default/files/css # ls -l
insgesamt 872
-rw-rw-r-- 1 wwwrun www 158526 22. Jan 12:10 css_2c40e29bada7df2a0872e3284d5906c0.css
-rw-rw-r-- 1 wwwrun www 164051 22. Jan 12:04 css_509f375f4dd1349c65961ef65612b39f.css
-rwxrwxrwx 1 root   www  62359 20. Jan 23:35 css_715c2ea6e483943b9fb7a7870eb8d3af.css
-rwxrwxrwx 1 root   www 163905 20. Jan 23:35 css_7d8ae0563cfe8042f1ae8c8b997decaf.css
-rw-rw-r-- 1 wwwrun www 158378 22. Jan 12:08 css_ad58026023b58c62611ee2690b7767ed.css
-rwxrwxrwx 1 root   www 164051 20. Jan 23:52 css_dc93777fb44b0e70ce92cdbc3fb098e9.css
-rwxrwxrwx 1 root   www    869 20. Jan 23:35 css_dfe74e375bbbe435aaa2c17f83c4843a.css
linux-vi17:/srv/www/htdocs/com624/sites/default/files/css #

and here the javascript-files

linux-vi17:/srv/www/htdocs/com624/sites/default/files/js # ls -l
insgesamt 2004
-rw-rw-r-- 1 wwwrun www 252042 22. Jan 12:09 js_49eafedecb47a7ddbcbaca1afe9934bd.js
-rwxrwxrwx 1 root   www 116020 20. Jan 23:35 js_5b2fd4858d6549bf716717a2aeff7ec8.js
-rwxrwxrwx 1 root   www   2619 20. Jan 23:35 js_5e4cf1f9d580681533f28941e5369206.js
-rw-rw-r-- 1 wwwrun www 291843 22. Jan 12:04 js_7308bd15ff335fb80932a983f43a674e.js
-rw-rw-r-- 1 wwwrun www 244292 22. Jan 12:08 js_7fccee0ff92c41edc64dbe9af3cc42d5.js
-rwxrwxrwx 1 root   www 291843 20. Jan 23:52 js_b03baa42e9679d7c9bfa96bf43b644de.js
-rwxrwxrwx 1 root   www 291460 20. Jan 23:35 js_b6a467b980c752283820195189e6e5e0.js
-rw-rw-r-- 1 wwwrun www 289758 22. Jan 12:10 js_c97e31b30c535ae5779711f7966b6096.js
-rw-rw-r-- 1 wwwrun www 252637 22. Jan 13:49 js_e4cc5b6ab05a295dab73ce5aac20ac1d.js
linux-vi17:/srv/www/htdocs/com624/sites/default/files/js #

Note: and what we can see here in a good way - the files are generated at different times. (note this is not!!! the mentioned site with the broken style - this is a site that is runned locally on the local lampp)

Well what makes me wondering is the following fact we have very differnet owners of the files - see that we have sometimes have

root   www
wwwrun www

question: why is this so!? i do not understand this! OR wait - the owernship corresponds with the permission (chomod..) what do you think? in othe words: is there a relationship between the permission which is in one case pretty much/ high ]

-rwxrwxrwx 1 root   www   2619 20. Jan 23:35 js_5e4cf1f9d580681533f28941e5369206.js

and in the other case pretty low / weak and this correspondents/results in the wwwrun-user:

-rw-rw-r-- 1 wwwrun www 291843 22. Jan 12:04 js_7308bd15ff335fb80932a983f43a674e.js

latest Update: after adding the files i have the following results: http://campus-24.com/?q=home


texts: How can I send an email to the previous comment author when a user places a new comment?

texts: I want to get the Email address of last comment's author. Actually, I want to send email by creating a rule  when new comment posted and this email will go to the user who commented on node before this new comment.


texts: How do I keep Access control modules from interfering with a view page?

texts:
I've been trying to add access control to my page I'm working on recently. And I've run into a major issue so far.

I have a view page that is set to allow anyone with the permission to view their own unpublished content. Anytime I enabled acl or og_access and rebuild the permissions that view page is ended up acces denied to any non-admin user. I've tried changine the views permissions and recreating it completely, but for some reason trying to get this build to do this one thing is not working.

If I turn off access controls and rebuild permissions everything is fine, but I need access control.

Any thoughts or suggestions would be helpful.

Views Version 7.x-3.14
Access Control List Version 7.x-1.1
OG Access Version 7.x-2.9


texts: Get() on array in settings from custom Form controller

texts:
I'm making a custom module with a form controller, that has a text_format field.
I'm storing the text_format value in my submitForm function like so.

public function submitForm(array&$form, FormStateInterface $form_state) {
    $this->config('foundation.settings')
         ->set('infoblock_text', $form_state->getValue('infoblock_text'))
        ->save();
}

I'm attempting to retrieve that for the default value of the field like so

    $form['infoblock_text'] = [
        '#type'          => 'text_format',
        '#title'         => t('Infoblock text'),
        '#description'   => t('The body text for the infoblock on the front page'),
        '#format'        => 'full_html',
        '#default_value' => $config->get('infoblock_text'),
    ];

However it's empty. After performing a die(print_r($config->get('infoblock_text'))) I found that infoblock_text is actually an array and 'value' is the key that contains the text I need. This is what the die() statement returns

Array ( [value] =>
Text of infoblock
[format] => full_html ) 1

After seeing that I actually needed to retrieve the value element rather the entire array I attempted the following with no luck.

$config->get('infoblock_text', 'value');
$config->get(['infoblock_text', 'value']);
$config->get('infoblock_text')->value;
$config->get('infoblock_text')->value();
$config->get('infoblock_text')->getValue();
$config->getValue('infoblock_text');
$config->getValue('infoblock_text');
$config->getValue('infoblock_text');

So how would I actually retrieve the value of 'infoblock_text', when $config->get('infoblock_text') returns the entire array?


texts: How do modules come up with their green, yellow, and red releases?

texts:
As we all know, not every module marked "Recommended Release" on drupal.org is truly stable. In fact some modules are perpetually marked beta, in some sort of permanent limbo state. Even when hundreds of sites use them every day.

I was wondering what kind of standards or best practices do you use, as a maintainer or contributor, in your modules to mark releases 'Recommended' (Green), 'Other' (Yellow), or 'Dev'(Red)? What do you use when marking it beta, alpha, or stable as well?

Thank you in advance for any advice, help, or documentation you can provide.

NOTE: Many of these standards may be general standards for coding or project development. I simply wanted to know what methods or standards are used in Drupal modules specifically, even if they are / can be generalized.


texts:
I have a question concerning Multiple Taxes with multiple content types in Ubercart 3 on Drupal 7.

I have 2 different tax rates:

8%
2,5%

and 2 content types or product classes

Products food
Products accessories

I want to apply the tax rate 8% to product accessories and 2,5% to products food and I woked around "Conditions" in order to do that, but, when I complete the order form my cart and go to checkout I obtain something like that:

Subtotal: 29.00 CHF
Colis Standard: 10.00 CHF
Subtotal excluding taxes:39.00 CHF
TVA 8%: 2.32 CHF
TVA 2,5%: 0.06 CHF
Order total: 41.38 CHF

In this case (above) in my cart I have just one item of product accessories ( with an 8% TVA ) and nothing else.

If, on the other hand, I buy one or more items for product food I get this:

Subtotal: 9.00 CHF
Colis Standard: 10.00 CHF
Subtotal excluding taxes: 19.00 CHF
TVA 2,5%: 0.23 CHF
Order total: 19.23 CHF

No 8% VAT was included in this case...

If I change weight of tax rates, on the contrary, I obtain this:

Subtotal:   9.00 CHF
Colis Standard: 10.00 CHF
Subtotal excluding taxes:   19.00 CHF
TVA 2,5%:   0.23 CHF
TVA 8%: 0.02 CHF
Order total:    19.24 CHF

My question is:
How can I apply related Tax Rate to each line item of the cart/order based on content type or product class?

Example

my product accessories: 10 CHF + 8%

my product accessories: 5 CHF + 2.5%

my other product accessories: 13 CHF + 8%

Total......

I hope I explained myself.

Thanks in advance!!

............................................FIXED!

Ok, I guess I found the solution...
I had to uncheck "Tax" checkbox in Taxed line items
Thanks anyway!

CYA


texts: Where do you set node revision permissions?

texts:
I’m using Drupal 7. I created a Content Type called ItemRequests.
One of the fields is a Body field.
As my authenticated users keep editing this Body field at different times, I want them to be able to see the full Body field revision history.
I went to the Content Type —> Edit, and made sure Create new revision was checked. However, when I edit an ItemRequest node, it says I (the administrator) do not have permission to view revisions? Where do I set up permissions for node revisions?
My users want to view the editing history for these nodes.


texts:
I have not messed around with themes much yet, but I would really like to be able to adjust the relative width of different blocks in my Bartik theme. As you can see in the screenshot, my panel is not quite big enough to display both views without overlapping, and there is plenty of extra space on the sides.

How does one change the relative widths assigned to each block?  Also, when I start making changes like this, would it be wise to make my own copy of Bartik and store it elsewhere?


texts: how to filter view content by field value?

texts:
I have one content type (article) and in that I have created field "Article category" which is Term reference.

I have created a view page where I am displaying (content title, Article category and post date) and Filter criteria is (Content: Published (Yes), Content: Type (= Article), Content: Article category (exposed)) and created Exposed form block.screenshot attached.

when I use exposed filter and check and categories filter is working as expected.

but my client also want to filer data when she click on any field category.

please assist to solve this issue.


texts: How to Disable "Upload" in IMCE to only keep "File browser"?

texts:
I'm working on a website (Drupal 6) where filefield and IMCE are set to upload media into nodes.

The customer don't want the users to upload files in the default directory but in specific places, for this reason he asks me to remove the "upload" possibility and only keep the "file browser".

How can I say to the widget to use "file browser" by default?


texts: How to setup event registration and paypal payment?

texts:
We have events and we take registrations for them. Entity Registration module is installed for that purpose and it's working great. Now, since those events are paid events, we want to implement PayPal payment method as well.

The problem is we need to combine the registration process and the paypal payment into one process. That said, user should click the button Register & pay and that should do 2 things:

Register the user for the event (this is already working as a part of Entity Reg module)
Redirect the user to PayPal payment gateway

Any suggestions on how to achieve this?


texts: I am considering automatically assigning the uid to several of my content types automatically.  However, one other data type uses a number as its title too (product number actually.)  There is a strong potential for a uid to be the same as a product number.  Could this potentially cause problems?  What are some common problems that can arise from non-unique titles?


texts:
I have a contact (web)form in my sidebar on my site and I would like to display a custom confirm message when a users submits the form. However, this message should replace the contact form.

I've tried with Inline Messages or with the form-settings (no-redirect), but every solutions just redirects the entire website to the node and displays the message inline. So, that not what I want, obviously...

So, is there a solution where the content of the page remains unchanged, but when submitting the form in the sidebar, only the sidebar refreshes and shows the confirmation message?


texts: Uninstalled fb module, but page still pings fb connect for every pageload

texts:
I uninstalled the fb module and all its submodules from my site and deleted /sites/all/modules/fb folder completely. But for every pageload, the site still calls for these files:

http://connect.facebook.net/en_US/all.js
and a few others.

I want them removed as these slow down my pages completely. I have nothing other than a facebook like button on my homepage, and this was added with sexybookmarks. Any help?


texts: User Relationships - Full Profile2 Access

texts:
I am looking to create a dating site using Drupal which is similar to Tinder, where you swipe/mark your interest in another user and if that user swipes/marks an interest back, then contact information is shared.

Match Making Process

Man can see a list of women
(The above I should be able to do with search results/views)
Man likes woman and 'flags/marks' their interest
Woman is notified
Woman accepts or declines
a. If accept - their contact information is shared with each other
b. If declined - notification is sent to man

(this process is reversed for women seeking men)

Profile

Name - Public
Age - Public
Telephone number - Private until shed with certain user
Email address - Private until shed with certain user

What I am wondering is how to upon 4.a. (Accept) to share the Private Contact information of the profiles with the other parties? SOLVED - User Relationships & Profile2

EDIT

I have discovered the User Relationships module which does 90% of what is required. However, how would I allow friends access to each others Profile2 full profiles?


texts:
I'm implementing http://phactory.org/ to get away from the heavier aspects of test data creation.  One of the prerequisite items for this is to start with an empty database, with proper schema.

I need to do this in drush so I can incorporate this into Jenkins or another CI process.

The options as I see them are:

1) write my own drush command which copies a local db using sql-sync, but truncates the tables.  This seems brittle

2) create a test database and use drupal_install_schema().

My current process is to take a schema-only copy of the db (as described here) and then create a new test database from it.  In between tests, I just truncate the data.

What options am I missing to copy the schema from the drupal db to another test db to handle test data?

What is the better of the options?


texts: Remove the "Please wait" text on Ajax Call

texts:
I am trying to remove the text "please wait" that happen on every Drupal Ajax call. Could anyways one point me the way to achieve this in an elegant manner (without any module or CSS hack)?

Thanks


texts: How to add a class for anchor tag for particular view using pager.html.twig?

texts:
I have been trying to add class for anchor tag, but I could not find the right way to achieve this.

I want to add class for particular pager in view. There is no pager.html.twig for particular id.

I have already enabled the twig debug in services.yml . Its not showing any suggestion

Can I try in preprocess_pager() ?

Please some one help me to achieve this !