texts: How to implement and install Icomoon and Fontello icon packs in Drupal 7?

texts:
I am trying to get Fontello and Icomoon icon packs installed properly.

I look in the backend and it says import for Fontello and Icomoon.

I have downloaded the packages, but importing creates an error.

I have manually downloaded and extracted them, put them in my libraries and:

Renamed folder: Fontello

And

Renammed folder:  Icomoon

But not found under status report, not even as missing. I have installed the Icon API module and enabled it.

Additionally, Fontawesome installed correctly and is showing ok in status report but it stil shows this error:

The Font Awesome library could not be found.Please make sure that     fontawesome was download & extracted at sites/all/libraries/fontawesome directory.Please check README.txt for more details.


texts:
I had installed a drupal website inside a folder in web root on an amazon ec2 instance. I used to access it by calling http://xx.xx.xxx.xx/folder .Now that the site is finished i created virtual hosts in my http.conf file to point the domain name to folder. I edited trusted host patterns in settings.php. So far so good! http://mydomainname.com points to front page.

PROBLEM:
when i click on links it shows 404 because path is http://mydomainname.com/folder/link instaed of http://mydomainname.com/link The front page parameter in site settings in admin side is uneditable.
How can I change that..? Please Help.


texts:
I have the Simple LDAP (7.x-1.4) module installed and it works perfectly fine with existing accounts on my LDAP server.

I need to use the read-only connection. In addition I need to create sometimes some pure Drupal accounts. I even can create these accounts, but after creation, I can not log into these accounts, nor view their profile pages /user/xyt, as long as I am not logged in as admin.

Is there a way in Simple LDAP, that Drupal first searches in the DB for the account, before Drupal checks LDAP? Why can I even not view the profile pages?

Do I maybe need to use the full LDAP module, to use parallel Drupal/LDAP accounts?


texts: Difference between search_api_solr and apachesolr

texts: I would like to know the difference between these two modules, what are the advantages and disadvantages?


texts: Strangly I seem not to be able to delete an existing workflow as a whole, nor a state within a workflow. The admin user has all the necessary permission. No content type is assigned with the workflow. What do I not see?


texts: Assigning css class to a particular block

texts:
I want to add a CSS class to a particular block. I am using the module Block Class for it as shown in block_class module. I am able to enable the module and assign the class by going to structures/block/configure. I am facing problem in where to add the php snippet. I am using a Zen starter kit theme and have copied the block.tpl.php from Zen/templates to my theme/templates and added the lines as specified...

Here's what my code looks like:

Before:

<div id="<?php print $block_html_id; ?>"
class="<?php print $classes;   ?>"
<?php print $attributes; ?>>

After:

<div id="<?php print $block_html_id; ?>"
class="<?php print $classes; ?> **<?php print block_class($block);** ?>"
<?php print $attributes; ?>>


texts:
Possible Duplicate:
  Drop down menu in drupal 7

How can I add the drop down menu item to the navigation menu in the Bartik theme?


texts:
I'm having this error on my website EntityMalformedException: Missing bundle property on entity of type commerce_line_item. in entity_extract_ids() (line 7866 of /var/www/xxx/xxx/includes/common.inc). and I don't know why it showed up recently.

Any one has encountered this error?


texts: How to display an add content form inside another content view page?

texts:
Basically I'm looking to make a beefed-up comment system. I'd like to have a content-type B that acts as a comment like entity for content-type A.

Question: When content A is viewed, at the bottom of the page the node/add/content_type_B form should be there with a 'Save' button which will create a new piece of content. Is it possible to render the content type B add form inside the content A view page (no Panels/Display Suite please)?


texts: Best way to migrate text field to taxonomy reference field

texts:
I want to migrate a text field to taxonomy reference field( the Tags one).

I've 1200 nodes having a field "Organization name". Those creating the content are making mistakes like misspelled company names. I'm using the company name in the views to find all related nodes.

This will help those entering can simply choose the company names or if someone has entered IBM for International Business Machines then I can merge those terms when using taxonomy reference field.

Should I go and create a vocabulary, add all existing values as terms in vocabulary then programmatically assign the text field values to the taxonomy reference field? Then delete the text field and change references in the views etc.


texts: Make form to show multiple field widgets with predefined values

texts:
I have a node form with multivalue field (cardinality unlimited). I need to show user 3 widgets if this field with predefined value (like shown at screenshot).

At screenshots I show the current form, and its desired look.

How can I achieve this result?


texts:
From the log (set as "error"):

SearchApiException while optimizing Solr server local solr server: "0" Status: Request failed: request timed out in SearchApiSolrConnection->checkResponse() (line 541 of /var/www/domainname/sites/all/modules/contrib/search_api_solr/includes/solr_connection.inc).

What does this error message mean?


texts:
Is there any way to set all of the tabs on Quicktabs to closed or inactive by default?

I would like, that if I visit the page then the first Quicktab isn't open by default. In this inherited site there are images and content underneath this open tab that I would like visible instead of an opened tab.

Would I have to implement something using JavaScript or is there a better option beside Quicktabs?

Quicktabs Version: 7.x-3.8 | Drupal Version: 7.57


texts: How to add new data to field that support multiple field via JSONAPI?

texts:
I am using jsonapi to PATCH(update) a content in a content type called "engagement". All the APIs including patch are working fine. However, when I am trying to update a new value to a field with multiple value support, it is replacing existing content with new one added. So, if I already had 2 value and later add one via PATCH. It replaces the first with the new one.

Request type: PATCH
Post Body:

    {
    "type": "node--engagement",
    "id": "a799952f-0528-409e-bf9b-707469e35d68",
    "attributes": {
        "body": {
            "format": "full_html"
        }
    },
    "relationships": {
        "field_attendance": {
            "data": [
                {
                    "type": "paragraph--attendance",
                    "id": "12qw",
                    "meta": {
                        "target_revision_id": "12"
                     }
                 }
            ]
        }
    }
}

The field am referring to is field_attendance. I am able to add any no. of data while updating/creating. However not able to update new ones.


texts: How do I enable the Views Contact Form module?

texts:
I cannot install the Views Contact Form module because it depends from the Email module, which is said to be missing, in the module page. The Email module is not a Drupal 8 core module.

How do I install that module?


texts: How to replace spaces with dashes when redirecting users through Rules?

texts:
I have a rule that redirects users on login to a matching taxonomy term, ie. there is a taxonomy term that is identical to the user name and when a user logs in they are redirected to the url of that taxonomy term using tokens. The redirected url is as follows:

taxonomy/[account:name]

However, when there is a space in the user name then this causes problems, the URL of the taxonomy term has spaces automatically replaced with dashes, however the rule treats spaces as spaces and creates a url such as "mysite.com/taxonomy/first%20second"

Is there a way to replace the spaces with dashes?


texts: How to find an article title for specific post

texts:
So, I am new to drupal, and I am using a small pdo library to directly fetch from database list of articles, to display them on a page that is not running drupal. But, the articles are posted using drupal cms.

My problem is that, also I am able to fetch the article content, node id ... but I can't seem to find the title of article itself.

I looked in my table, and these are all the data I have.

mysql> describe field_data_body;
+--------------+------------------+------+-----+---------+-------+
| Field        | Type             | Null | Key | Default | Extra |
+--------------+------------------+------+-----+---------+-------+
| entity_type  | varchar(128)     | NO   | PRI |         |       |
| bundle       | varchar(128)     | NO   | MUL |         |       |
| deleted      | tinyint(4)       | NO   | PRI | 0       |       |
| entity_id    | int(10) unsigned | NO   | PRI | NULL    |       |
| revision_id  | int(10) unsigned | YES  | MUL | NULL    |       |
| language     | varchar(32)      | NO   | PRI |         |       |
| delta        | int(10) unsigned | NO   | PRI | NULL    |       |
| body_value   | longtext         | YES  |     | NULL    |       |
| body_summary | longtext         | YES  |     | NULL    |       |
| body_format  | varchar(255)     | YES  | MUL | NULL    |       |
+--------------+------------------+------+-----+---------+-------+
10 rows in set (0.00 sec)

Just as example, I am doing

$db = new DB(...);
$stmt = $db->query("SELECT *, entity_id as id, body_value as content from field_data_body where entity_id < 10  LIMIT 8");
$result = $stmt->fetchAll();

foreach($result as $row){
  echo $row['title']; //error.
}


texts: Using hook_form_alter in overlay admin theme

texts:
I am using hook_form_alter in a custom module to remove some fields from the block edit screen to clean up the ui for users of a certain role

function module_form_block_admin_configure_alter(&$form, &$form_state, $form_id) {
  global $user;
  if (in_array('staff member', $user->roles)) {
    $form['visibility_title']['#access'] = FALSE;
    $form['visibility']['#access'] = FALSE;
    return $form;
  }
}

It works great. However, when the form appears in Drupal's admin overlay using the site's admin theme, Seven, the above code is not applied.

Is this because it's in an overlay? Or because it's a different theme? How can I get the hook_form_alter to apply globally?

FWIW, adding

function module_form_alter(&$form, &$form_state, $form_id) {
    dpm($form);
}

doesn't print anything above the form in the overlay. But when I switch the admin theme to the site's theme, it properly dpm's the form.

Note: The custom module and the site's custom theme have the same name. Is this the problem?


texts:
I is possible to:

Hook on views_pre_view (which is executed before form_alter)
Query view data (execute the view query filtering according to URL parameters) and collect some data
Hook on form_alter
Replace some selects using data collected on item 2?

I'm asking because if I $view->execute() inside views_pre_view (to filter and use view data) it will internally call form_alter and generate the form before I'm able to collect the data to pre-populate my selects. And I'm not sure if it's possible to re-generate a form that was already generated.
I also tried views_pre_execute but this one is always executed after form_alter.
Cheers!


texts: Calling a module function name in Ajax URL

texts:
I am developing a custom payment gateway for Drupal Commerce. I am getting some problems calling a custom module function from an AJAX URL.

How do I call a module function from a custom AJAX request?

function custom_gateway_settings_form($settings) {
  $form = array();

  $form['code'] = array(
    '#type' => 'textfield',
    '#title' => t('Code'),
    '#maxlength' => 100,
    '#description' => t('Code.'),
    '#prefix' => '
',
    '#suffix' =>'
',
  );

  $form['btncode'] = array(
    '#type' => 'submit',
    '#id' => 'btncode',
    '#value' => 'Get the code',
  );
}

The JavaScript code is the following one.

   jQuery("#btncode").click(function() {
     jQuery.ajax({
       type: "POST",
       url: Drupal.settings.basePath + "/?p=ajaxGetCode",
       cache: false,
       beforeSend: function() {
         // jQuery('.loadrimage').show();
         // jQuery(".error").hide();
       },
       complete: function() {
         // jQuery('.loadrimage').hide();
       },
       success: function(htmlText) {
         alert(htmlText);
       }
   });


texts: Negative value for graphicXOffset not being applied

texts:
Please compare these two maps.

On this map ...
http://dev.lambeth.gotpantheon.com/map
Notice the location police helmet image, bottom-left near to Union Road.

On this map ...
http://test.lambeth.gotpantheon.com/map
The actual location of this police station is indicated by a blue circle.

The problem is that we need to have the graphic raised by 20px or so so that it points to the correct location.

When we add a negative graphicXOffset in the style settings, nothing happens. (A positive value does work, but that's not what we want).

See screenshots here: http://drupal.org/node/1808794


texts: Leaflet views: how to zoom on the marker while clicking on it in order to get the popup

texts:
I am using the module Leaflet and its sub-module "Leaflet views"" in order to get a map displaying markers based on taxonomy terms.

I am able to show a popup displaying the term page while I click on a marker.

Now, my actual requirement is when I click on the marker, the map is zoomed on the clicked marker (zoom of maximum 3 levels) and just after the popup is displayed. So, my map behavior on the marker click event contains two steps: zooming and popup opening.

How can I hook the module in order to enrich my views?


texts: How to link taxonomy terms to custom views

texts:
I have a vocabulary "destination' with 4 terms (dest1, dest2, dest3, dest4)
Then I have another vocabulary "category" with tons of terms (parents and childs)

I need to create a custom view (not from core) that will display the "destination" and also the "category" my content types are associated with (something like: /dest1/category/child/child, /dest3/category/child).

my setup in short:
- I have a view of type "Term", displaying as a block with one field set as Taxonomy: Term ID set to "Exclude from display" and another one set as Taxonomy: Term name (linked to its taxonomy term page)
- I have a second view of type "Node" (this is the default drupal taxonomy term view)
with a page display and a Taxonomy: Term ID argument

The setup works (for "category" anyway) until I try adding a destination to appear in front!! From what I understand I would need to create 3 other pages with a modify the paths but as soon as I try to change the path /taxonomy/term/% it defaults back to core display.

any help would be greatly appreciated (hope I gave enough information... not easy to describe a problem when confused)

Thanks


texts:
I have a video upload form which a) updates an entity table and the file_managed table in the Drupal database, and b) uploads the video file to Amazon S3 using the Drupal AmazonS3 module.

I also have a transcoder function which call AWS Elastic Transcoder to transcode the file in S3 into various formats.

Both functions currently work independently.

My problem is finding a way to trigger the transcoder function AFTER the file has successfully completed uploading to S3.

In a similar setup outside of Drupal, I have used the S3 response headers, success_action_redirect or success_action_status, to determine that the file has successfully uploaded, and then call another script.

Within Drupal, how can I trigger the transcode function after S3 reports a successful upload?  If using the S3 response headers is the way to go, how can I access those responses?


texts: How can I make a view showing all users who have not created any nodes or made comments?

texts:
I am trying to fix a site that has had more than 10,000 spam user registrations.  However, some legitimate user registrations have also been made, so I cannot simply delete all the accounts.

Manually sorting through all of this would take a very long time.  However, it appears to be the case that no spam users made any comments or created any nodes.  So, I thought I might be able to create a view that shows all the users that have not created content or made any comments, and then use VBO to delete all such users.

But, although I can make a view that shows users who have created content, I haven't been able to figure out a way that shows users who have not created any content/comments.  How might I go about this?


texts: Prevent form regeneration when a callback function is called through ajax

texts:
Here is the code for the custom form with a field(field_B) that calls an  function through ajax.

The issue is that I want the function (MY_MODULE_XYZ_function()) to be executed only once, when the page loads for the first time. But the function(MY_MODULE_XYZ_function()) is being executed for each ajax call through field_B because the whole form is being regenerated.

How can I prevent whole form regeneration(so that the function won't be called more than once) for each ajax call? Thanks in advance.

function MY_MODULE_menu(){
    $items['abcd/xyz'] = array(
        'title' => 'ABCD',
        'page callback' => 'drupal_get_form',
        'page arguments' => array('xyz_custom_form'),
        'access arguments' => array('access content'),
        'type' => MENU_CALLBACK,
    );
    return $items;
}

function xyz_custom_form($form, &$form_state){

    MY_MODULE_XYZ_function($arg1, $arg2);

    $form['field_A'] = array(  .... );

    $form['field_B'] = array(
        '#type' => 'radios',
        '#options' => array("a"=>"A", "b"=>"B", "c"=>"C"),
        '#prefix' => "
",
        '#suffix' => "
",
        '#ajax' => array(
        'callback' => 'MY_MODULE_custom_ajax_callback',
            'wrapper' => 'customDiv',
            'progress' => array( 'type' => 'throbber', 'message' => NULL),
            'effect' => 'fade',
        ),
    );
}

function MY_MODULE_XYZ_function($arg1, $arg2){
    //Some Query Execution
}

function MY_MODULE_custom_ajax_callback($form, &$form_state){
    //Some Callback code
}


texts: Randomly display questions in Webform - to use as an exam

texts:
Is it possible to randomly select a fixed number of questions to display in a Webform? I have a request to set up over 500 questions in a webform but for each user who visits the webform, only a random selection of 100 questions will be displayed. The rest will not be displayed. The purpose of this is to use the Webform as an exam/quiz.

Note: the hidden questions cannot be visible in the code, so CSS or other Javascript hiding techniques are not suitable.

Any ideas how I might achieve it.

Thanks a mil

F


texts:
I developed a site using Drupal, and it's the first time that I create my own theme, subtheming the Zen theme.

If you try to go to www.garnisellacipriani.it with firefox or chrome, the visualization is perfect. If you try with IE, the banner with the images is not shown!

What can it be?

Thank you very much,
Alessandro


texts:
David Rothstein pointed out in the comments that as of Drupal 7.33, this functionality has been back-ported to Drupal 7.

Is there any template debugging technique similar to Twig debugging?


texts: I have a block that is cached per page. However, I need a way to invalidate it's cache in code per page or node. (Or, if no way, all cache per block id).


texts:
I would like to check if particular node instance exists then load that node. if the instance does not exist, then display message. So far:

function MODULE_menu() {
    $items['ds-some'] = array(
        'title' => 'Some',
        'page callback' => 'some_display',
        'access arguments' => array('access content'),
        'type' => MENU_NORMAL_ITEM,
        'file' => 'inc/some.pages.inc',
    );

    return $items;
}

function MODULE_theme(){
    return array(
        'render-some' => array(
            'template' => 'page--some',
            'variables' => array(
                'node' => NULL
            ),
            'path' => path_to_theme().'/templates',
        ),
    );
}

in file inc/some.pages.inc

    function some_display(){
            $build = array();

            $nid_some = db_select('node', 'n')
                ->fields('n', array('nid'))
                ->fields('n', array('type'))
                ->condition('n.type', 'SOME_TYPE')
                ->execute()
                ->fetchCol();

            //load first instance
            $someNode = node_load($nid_some[0]);

            if (!empty($shopNode)) {

//Attempt 1
    //            $build['ds-some'] = array(
    //                '#theme' => 'node',
    //                '#node' => $someNode,
    //                '#view_mode' => 'full',
    //            );

//Attempt 2
    //            $build['ds-some'] = node_view($someNode, 'full');

                $build['ds-some'] = array(
                    '#theme' => 'render-some',
                    '#node' => $someNode,
                );
            }
            else {
                drupal_set_message(t('It appears there is no instance present');
            }
            return $build;
    }

The first two attempts ended with the title of the Node instance but Drupal is no rendering the whole page(template file, views, etc). In my last attempt, i use custom theme function that it works, however. It is not rendering the context for the node type specified. How to specify context when working with hook_menu(), so that the context configured will load blocks and views? Thank you for any help.


texts: Drupal places a  after text automatically?

texts:
I have the below code, however when I place it within Drupal 6, Drupal places a  after the text 'Coordinator', see second code insert for the firebug info. I am not sure where this  is coming from? but it would be useful to remove as it means I have a text description, and the selection boxis on the line below. While all my other input box are inline with their descriptions.

Coordinator:<?php
 //Drop Down Select
 $sql = "SELECT user_id, concat (user_firstname,' ', user_surname) as username  FROM   user_tbl WHERE coordinator='True'";
    $result = pg_query($sql);
         echo "<select name='user_id'>";
       while ($row = pg_fetch_array($result)) {
          echo  "<option value='" . $row['user_id'] . " '>" . $row['username'] ."</option>";
 }
         echo "</select>";
?>

Second Code

Coordinator:

<select name="user_id">


texts: How can I create a view page that takes taxonomy machine name and has depth?

texts:
This question is a followup to How to load nodes that are associated with the child of a taxonomy term and refers to this answer in particular, but is standalone, so you need only visit those if you want more background.

I want to create a view that functions like the Taxonomy term view that comes with views with depth turned on in the contextual filter, but taking the term's machine name instead of tid as the contextual argument.

I have pathauto set up to alias /taxonomy/term/tid to /vocabulary/term, and I would like to override the page there with views to make it show nodes associated with the children of the term as well as the parent.

So if I had the following Taxonomy:

Vocabulary 1 (vocab_1)

Term 1 (term_1)

Term 2 (term_2)
Term 3 (term_3)

Term 4 (term_4)

Term 5 (term_5)

and nodes as follows:

Node 1 - Term 2, Term 5
Node 2 - Term 5
Node 3 - Term 3

A visitor to /vocab_1/term_1 should get a list that contains nodes 1 and 3 because they are associate with children of Term 1.

I haven't been able to figure out how to do that with the term machine_name as the contextual filter instead of the tid.


texts: Filtered html with class attribute not being stripped?

texts: How to extend "filtered html" by ability of using class attribute? I can't let user have full html, but classes seem to be useful.


texts:
I'm trying to delete from the dr_cache_form table,in D7, but somehow the record does not get deleted
                 function mymodule_multistep_form_submit($form, &$form_state) {
//.....

                 $form_id = array();
                 $form_id[0]='form_' . $form_state['values']['form_build_id'];
                 $form_id[1]='form_state_' . $form_state['values']['form_build_id'];
                 dd($form_id,'$form_id=');

             $query = db_select('cache_form', 'cf');
             $query->fields('cf',array('cid'))
            ->condition('cid', $form_id[0], '=');

$result = $query->execute()->fetchAll();
dd($result,'$result=');

                $deleted=db_delete('cache_form')
                //->condition('cid', $form_id, 'IN')
                ->condition('cid', $form_id[0], '=')
                ->execute();
                //dpq($deleted);
//              dd($deleted);
}

So in my drupal_debug.log file I find the entries corresponding to the above lines, but when I go to the database in mysql and select * from dr_cache_form where cid='the form id that was printed in the drupal_deug";
then the row is there, it isn't actually deleted.
Do I need to flush somehow the db_delete... all other database operations are working fine, insert, update, select... just this delete does not want to actual delete the row in the db.
the $delete variable is set to 1 after db_delete
I'm calling it from an multistep form in the last step of the form, thus the cid exists in the dr_cache_form table before db_delete is called, as I can see it via phpmyadmin, and also it gets printed in the drupal_debug whit the $result variable


texts: How can I conditionally add empty text field values based on a list selection?

texts:
I'm beginning to create a pretty advanced registration form that has all sorts of conditional logic in it. For instance, if a registrant chooses the "Diamond" level sponsorship in a list, the price increases $3000 and they're allowed to register 8 players for their team. In this example, I'd want a price field to increase by $3000 and I'd like an 'unlimited value' text field to display 8 text fields.

What's the best route to take when creating an advanced form like this with lots of interactivity? Traditionally I've used EntityForm Types and field dependencies, but I'm not sure how far that will get me.


texts: How to register a custom function for labelCallbacks for an existing entity?

texts:
I learned that in EntityBase the label method gets called to determine the label for an entity, for instance when it is rendered via the entity reference module as label.

Now, for specific node types I want to alter that label. In the module apparently a callback (alter?) gets called:

  public function label() {
    $label = NULL;
    $entity_type = $this->getEntityType();
    if (($label_callback = $entity_type->getLabelCallback()) && is_callable($label_callback)) {
      $label = call_user_func($label_callback, $this);
    }
    elseif (($label_key = $entity_type->getKey('label')) && isset($this->{$label_key})) {
      $label = $this->{$label_key};
    }
    return $label;
  }

How to register my own function for $entity_type->getLabelCallback()?


texts: How can Display Suite be used with Book module links?

texts:
After settings some node types to use Display Suite I have noticed those which are in Books don't show the book links at the bottom of the page.

Is there a work around for this?


texts: How can I let a group of users edit anything in a specific section?

texts: Our content editor wants to let the various authors have rights to edit things in only specific sections, and it will often be multiple people assigned to a given section.  What's the best way to do this?   (And sections do NOT map neatly to content-types.  They're based on the menu/site structure.)


texts:
I want to attach or embed a node form to a view so that when a user submits the form, the view below the form will be updated in realtime via ajax. The form will be shown above the view. My views block name is Statuses Stream.

I tried formblock module and putting the form in the header section of my view using views ui, but after submit, it was redirecting to the node created page.

Then I tried Advanced Form Block module. I created a form using AFB module. It is submitting the form with ajax, but it is not updating the view in the realtime.

I have just tried the Ajax Form Entity module. It is submitting and updating via ajax, but I cannot find a way to attach a view with it. However, in its settings, I can select a view mode. I need a little more flexibility.

How to Attach or embed node form to a view so that it submits via ajax and updates the view in realtime? I am open to any solution programmatically or through a module. Better if done programmatically because it will give more flexibility.


texts: Fatal Error: Call to undefined function in a drush backup module

texts:
I am getting a weird error when attempting to use Drush.

  Fatal error: Call to undefined function variable_get() in
  /home/1000/.drush/backups/pantheon/20161102190143/modules/xmlsitemap/xmlsitemap.drush.inc on line 29
  Drush command terminated abnormally due to an unrecoverable error.
  Error: Call to undefined function variable_get() in /home/1000/.drush/backups/pantheon/20161102190143/modules/xmlsitemap/xmlsitemap.drush.inc, line 29

I have disabled and removed the xmlsitemap module, but it looks like it is referencing some weird backup version of the module.


texts: Scheduled unpublished content and media that is under content moderation

texts:
Let's say you have a need for the following:

Content is created with content moderation, with various states.
After a set amount of time, the content is deleted or archived.
The user can set when media (using the media module) can be unpublished.
When the media is unpublished, it's truly gone from the system. Meaning, if you already knew the path of the file before (like example.com/site/default/files/blah.pdf), then after it has been unpublished, it can no longer be accessed because it's gone from the file system.

Playing around with content moderation, I can get it to published in a scheduled manner, but unpublishing seems to not be as straight forward. And media, well, that seems to stick around forever unless you truly delete it.
What am I missing? If this isn't a part of the contributed modules, what other options are there?


texts: CSS changes not taking effect in customized styles folder

texts:
I am trying to size the banner in a Jackson theme on my site to fit to the 960px wrapper size have in customized folder in sites/all/themes/mytheme/styles/mytheme.css but no matter what I do the length won't change, only the height which makes no sense at all.

I have tried flushing the cache several times but still no changes take effect.

The code in jackson styles.css is

#banner-wrap {
   background: transparent url(../images/main-sprite.png) repeat-x scroll center -90px;
   height: 133px;
   overflow: hidden;
   width: 100%;
}

I have successfully changed the height but if I change width from 100% to 960px it does nothing.


texts: How do I change a view pager submit from GET to POST?

texts:
Currently when I have a view pager at my site and I want to click on another site the pager gives me a link similar to "base_url/?page=0"
How can I change that so that the link just shows me the "base_url"?
In my understanding thats because the pager submit handles requests via GET.


texts:
I want to search for page name.

I have a title of page news and events. if i search event. i want news and event page will come on search results. when i click on that news-events page will open.

Any idea how to do this?


texts: Why does JQuery loop count last row in View twice?

texts:
I'm using JQuery in D7 to sum columns in a View with multiple attachments. The usual summing solutions, such as Aggregator Plus, Views Summary, ViewsCalc don't work across attached views. Everything works great except for some baffling reason it's counting the last row value twice. Can't figure out why. I've tried different Views table types, all do the same. Can't see any second value on the page or in DOM elements, hidden or otherwise.

The code to sum the values:

  jQuery('.views-field-views-conditional-5').each(function(){
    yourString = jQuery(this).text();
     if ( !isNaN(parseFloat(yourString.replace(/[^0-9-.]/g, '')))){
    yourNumber = parseFloat(yourString.replace(/[^0-9-.]/g, ''));
}
    sumYours += yourNumber;
    return sumYours;
  });

sumYours returns the total, but if there's a value in the last row of any attachment in the view it gets counted twice, messing up the math. The above code steps over header text (which gives NaN) and converts the currency string to a float to add them.

The Views last row does have a separate CSS class views-row-last, maybe I can check for that (not sure yet how) but this seems like a hack to mask some other issue.

Suggestions?


texts: Views filter criteria groups OR not working?

texts:
I have a view with FILTER CRITERIA set. I have three groups, each joined by ANDs, with the criteria within each group ORed. The final group are two taxonomy terms, meaning I want my query to return nodes that have one term or
the other. No node will have both of the tags set.

However, when I see the SQL in the preview, the terms seem are connected by a AND.

WHERE (((node__field_event_categories.field_event_categories_target_id = '434')) AND ((node__field_event_categories2.field_event_categories_target_id = '212'))) AND ((taxonomy_index.status = '1') AND (((DATE_FORMAT((node__field_date_range.field_date_range_value + INTERVAL -14400 SECOND), '%Y-%m-%d\T%H:%i:%s') >= DATE_FORMAT(('2018-10-22T04:00:00' + INTERVAL -14400 SECOND), '%Y-%m-%d\T%H:%i:%s'))) OR ((DATE_FORMAT((node__field_date_range.field_date_range_end_value + INTERVAL -14400 SECOND), '%Y-%m-%d\T%H:%i:%s') >= DATE_FORMAT(('2018-10-22T04:00:00' + INTERVAL -14400 SECOND), '%Y-%m-%d\T%H:%i:%s')))))

This causes my query not to return any results.

I've tried removing each tid, one by one, and when one is missing I get results. So I'm thinking I should get both sets of results when they are set to OR.

To make sure I was reading the SQL correctly, I ran it through a pretty-printer:

To double check, I exported the views config, to see what the yaml said about the WHERE clause, and it all seems to be OR within the groups:

I even re-imported the configuration from this yaml, but I still get the same results.

How can I get my taxonomy criteria to function using OR?

Edit
In the course of troubleshooting, I tried to simplify the filter criteria. I removed everything, all groups and criteria. This is what I have now:

This is Drupal 8.6.2. We just updated, so I'm wondering if this is a new bug.


texts: Can node refferences be automatically resolved in a view?

texts:
We are using drupal for data management for a web application. We're using the web-service api to get data from drupal views and use it on our app.

We are completely depended on views fetched via the web service.

When fetching a view, we would like to get all it's references already resolved. So if I have entity A with references to B and C, it would be great to get entity A with the data of B and C as well, not just the node ids.

Can such a thing be achieved via the web-service api?

Update:

After using relationships and a table list that can have reference node fields, I am able to see the aggregated data from B and C. I have the list of A type entities, with data from B and C, but when I request this data from the /webservice/views/MyView api I am not able to see the newly formatted data. I get the same old result with the target_ids instead of the fields that I chose in the table list.


texts: new domain not finding install.php for multisite

texts:
Don't know what is going on here except that this time instead of adding a subdomain for my multisite I am adding a new domain which is already pointing to same IP.

I have set it up exactly as subdomain except obviously the name in sites folder reflects another domain name.

When I go to the new domain address it links only to the root of the site and not the root of the drupal folder.

I have firstsite.com (links to plain html)

then sub.firstsite.com (links to drupal root folder)

then sub2.firstsite.com (links to drupal root folder by way of sites folder)

then secondsite.com (links to plain html even though on drupal root sites folder)

I NEED secondsite.com to behave in same way as sub2.firstsite.com

MY SET UP FOR VHOSTS

/etc/httpd/conf.d/my.conf

vi my.conf

my rules

NameVirtualHost *:80

ServerName firstsite.net
ServerAlias www.firstsite.net
ServerAdmin vps@firstsite.net
DocumentRoot "/var/www/html"

AllowOverride All
Allow from all

ServerName sub1.firstsite.net
ServerAlias www.sub1.firstsite.net
ServerAdmin vps@sub1.firstsite.net
VirtualDocumentRoot "/var/www/html/drupal"

ServerName sub2.firstsite.net
ServerAlias www.sub2.firstsite.net
ServerAdmin vps@sub2.firstsite.net
VirtualDocumentRoot "/var/www/html/drupal"

ServerName secondsite.com
ServerAlias www.secondsite.com
ServerAdmin vps@secondsite.com
VirtualDocumentRoot "/var/www/html/drupal"

ServerName localhost


texts: Changing Drupal's default email notification on password reset

texts:
I need to change the text the user gets in the email with the one time login url. How can I do that?
By the way, say I want to generate a login url from my module, is that possible?
I'm using drupal 6


texts: User list with View: display only on role

texts:
In addition to the Administrator role, I've created several roles. I'm still using the Administrator role for users who needs administrator access.

However, in my user list, I've created with Views, I'd like to hide the Administrator role, so it only displays the one role I've chosen instead of listing all the roles associated to the user.

I've already configured a filter criteria where I haven't included the Administrator role and only the roles I'd like to display, but Views disregards this and display the Administrator role.

You can see the members page here: You can see the list here: http://xpeek.dk/sas-members

I hope any of you can assist me in this.

Regards, Frederik


texts: Really confusing composer error output relating to working composer.json/.lock files

texts:
Warning: this may come across a little ranty! Up until version 8.3.0, I thought I had solved all my drupal + composer related issues.
With the following in composer.json:

"require": {
    "drupal/core": "~8.3"
}

I ran composer update. I got v8.3.0-rc2. After some playing around, I changed the above to:

"require": {
    "drupal/core": ">8.0"
},

which updates to the latest stable 8.x release. What is going on! Why would the first example not work?

Additionally, downloading Drupal in .zip form, the line reads:

"replace": {
    "drupal/core": "~8.3"
},

Why, when nearly every guide recommends putting this line in the 'require' array if you intend on updating via composer?

Furthermore, the widely recommended Drupal Composer Project has the following - perhaps crucial - line:

"repositories": [
    {
        "type": "composer",
        "url": "https://packages.drupal.org/8"
    }
]

I realised early on that without this line, many of my update attempts would fail in some way. Why would this line not be absorbed into the main Drupal distribution?

So many questions, and yet most Drupal + Composer pages across the internet forward us to the general composer website. It seems clear that Drupal is not fully compatible the 'general' composer methodology


texts:
I am trying to send an email with a small html form of hidden fields and a submit button. I have been piecing this together from several very incomplete answers and documentation sources that take several approaches to this but no answer so far has worked for me (so please do not mark this as a duplicate).

I have a module, my_module, and in the my_module.module file I have the following hook.

function ten_sixteen_mail($key, &$message, $params) {
    if (isset($params['subject'])) {
        $message['subject'] = $params['subject'];
    }
    if (isset($params['body'])) {
        $message['body'][] = $params['body'];
    }
    if (isset($params['headers']) && is_array($params['headers'])) {
        $message['headers'] += $params['headers'];
    }
}

Elsewhere in my_module.module I send an email with the following code. I am getting the email, but without the form and button html, only the  text.

$to = "someone@example.com";
$subject = "This is an email subject";
$body = "
Here is some text.
";
$body .= '<form name="someform" action="https://www.example.com/somepage" method="post">';
$body .= '<input type="hidden" name="somecode" value="' . $somecode . '" />';
$body .= '<input type="hidden" name="something" value="' . $something . '" />';
$body .= '<input type="submit" style="padding: 10px; background-color: #d42c2c; border: 2px solid #cccccc;" value="Click This" />';
$body .= '</form>';
$params = array(
    'headers' => 'Content-type: text/html',
    'subject' => $subject,
    'body' => $body,
);

$message = drupal_mail("my_module", "my_module", $to, language_default(), $params, "serviceaccount@example.com");

I have Mail System and Mime Mail installed and enabled.

I'm pretty confused about the config options for both modules. For Mail System I have set the 'theme to render the emails' to my custom theme, though I really don't require any theme-ing of the email it was not an option to disable this.

I have created a new module and key setting with the key my_module for the module my_module.

Mime Mail is set to use the Full HTML Email format.

What am I doing wrong that is preventing my html form from coming through in the email?


texts: Allowing content access only though aliases and views

texts:
I'm building a site in Drupal 8 that will have complex content best viewed using views. The basic pages should use nice and clean URL aliases.

Is there a way to stop the visitor from accidentally using /node/x in the URL and only allow accessing the views and pages that have aliases and organised in the website menus?


texts: How do I translate the Book module tree navigation?

texts: We only have English and Spanish translations on our website. I can easily translate each book page, but there doesn't seem to be a way to translate the book tree navigation. Is there a way to translate the book tree navigation so the links will display translated text and link to the translated pages?


texts: Storing Drupal form values when using tablesort or paging

texts:
I have a custom form where I use a tableselect, and a couple of textboxes and checkboxes. The query for the tableselect is extended using TableSort and PagerDefault.

I noticed that when the user sorts a column, or goes to another page (using the pager), Drupal does a simple redirect which wipes all values in the textboxes and checkboxes.

This even occurs when looking at the inbuilt /admin/content screen.

I can't really expect the user to sort and page the table, and then enter textbox values. And sorting and paging is pretty standard functionality. Is there anyway around this?


texts: How to disable delete once the thread has been started in advanced forum module in drupal 7?

texts:
If there are no comments on the current topic then user can delete the post.

If there are one or more comments on the forum-topic then user will not be able to edit or delete forum-topic.

Which module should i use or which hook needs to be implemented?


texts: Problem with the schema structure produced by Schema module

texts:
I have a drupal 7.34 installation in my local computer. I also installed schema 7.x-1.2 module. Now

Below is my code:

function myid_schema(){
    $schema = array();
    $schema['myid_templates'] = array(
        'description' => 'TODO: please describe this table!',
        'fields' => array(
            'template_id' => array(
                'description' => 'TODO: please describe this field!',
                'type' => 'serial',
                'not null' => TRUE,
            ),
           'template_name' => array(
               'description' => 'TODO: please describe this field!',
               'type' => 'varchar',
               'not null' => FALSE,
           ),
           'portrait' => array(
               'description' => 'TODO: please describe this field!',
               'type' => 'boolean',
               'not null' => TRUE,
           ),
           'template_width' => array(
               'description' => 'TODO: please describe this field!',
               'type' => 'numeric',
               'not null' => TRUE,
               'default' => 0,
               'precision' => 0,
               'scale' => 0,
           ),
           'template_height' => array(
               'description' => 'TODO: please describe this field!',
               'type' => 'numeric',
               'not null' => TRUE,
               'default' => 0,
               'precision' => 0,
               'scale' => 0,
           ),
       ),
       'primary key' => array('template_id'),
   );
   return $schema;
}

/**
* Implementation of hook_install().
* Perform initial setup tasks.
*/
function myid_install(){
    drupal_install_schema('myid_templates');
}

After installing my module, it throws an error:

Notice: Undefined index: boolean:normal in DatabaseSchema_pgsql->processField() (line 229 of C:\xampp\htdocs\drupal-7.34\includes\database\pgsql\schema.inc).

PDOException: SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near "NOT" LINE 4: portrait NOT NULL, ^: CREATE TABLE {myid_templates} ( template_id serial, template_name varchar NULL, portrait NOT NULL, template_width numeric(0, 0) NOT NULL default 0, template_height numeric(0, 0) NOT NULL default 0, PRIMARY KEY (template_id) ); Array ( ) in db_create_table() (line 2720 of C:\xampp\htdocs\drupal-7.34\includes\database\database.inc)

Why does it throws an error when my code is copied from the schema structure produced by the schema module? How will I fix it? By the way I'm using postgres.


texts: How to do something BEFORE a view is updated via ajax submit button?

texts:
I have a view with exposed filters and Ajax activated.
I would like to validate my exposed filters values before my view is updated by the submit button.
The following code works without Ajax, but when I activate this functionalitty it doesn't validate!

jQuery('FORM ID').submit(function () {
  jQuery('FILTER TEXTFIELD').val(MY VALIDATION);
  return true;
});

How can i capture the ajax execution and validate my values BEFORE the ajax call?


texts: How can I rename a menu machine name in drupal 8

texts:
I ve migrated my D6 site to D8. And now I'd like to rename my menu machine names(not the system menus my custom menus) to a different ones. I'd want to do this either on database or from code.

Any ideas??


texts:
I have set my "Private file system path" for uploaded private files (admin/config/media/file-system), but I am confused as to how to add any files to that directory. I expected to find a private files section in CKFinder.

How do I move files into the private directory?


texts:
I want to use aegir for a website that users can create their own sub-sites.

From aegir installation guide:

  when a new site is installed, the web server will be automatically configured (vhost) and restarted

Does this mean that every time a new subsite will be created, server restarts and will be out of access for a few seconds?


texts:
I have three blocks A, B and C on the home page on location Content Bottom. I have another block D I want to place at location A+B and I want to keep C at the same location. I will move A and B to another location on the layout. How to do that? Currently when I place block D at Content Bottom it only takes the space (and width) of block A and other two columns look Odd. Block D now shows up as a single long column. Not a developer, using Drupal for three years, always learning more about Drupal. I know a little bit about css files and css injector.

If I place block D at Tertiary Content location, it takes the whole width of the screen. It shows below the region for A, B and C.


texts:
I'm quite desperate right now and pretty newbie with Drupal. Anyhow, I wan't to develop my WordPress site and change this current system to Drupal. So now i'm able to set user specified galleries and images for customer to Proof images.

I should also make customer galleries that shows products by customer.
Currently I'm creating galleries for customer and they can purchase images: Canvas, prints and digital downloads on specified image.

Is there way to create products once I upload images to Drupal?

One image could be sold in various different ways Like:

Digital image:

2048 px size
Full Image size

Canvas:

20x30cm
30x40cm
40x55cm

Ans so on.
At this point im using Sunshine Photochart for that, but it's kinda messy design.


texts: How to display an overlay image in modal window (Colorbox) upon hover

texts:
I have a series of images set up to display in modal lightbox-type windows – specifically, using the Colorbox module.

The goal is for each image to be paired with a companion graphic overlay which is displayed upon hover over the Colorbox display.
Think of it as (1) the photo, and (2) the "circles and arrows" overlay (maybe .gif or .png with transparent whites).

Can anyone verify its feasibility and suggest a path to this result?


texts:
I have a content type that has a taxonomy field with two options. If Option A is selected, I want a further taxonomy field with items from Taxonomy X. If Option B is selected, I want another taxonomy field, but with items from Taxonomy Y.

In Drupal 6 I used Conditional Fields, which was great. However, there exists no stable D7 version yet, and I need this functionality for a project due this week. The project page even says: "Drupal 7 version (3.x): 7.x-3.x is currently in development. It is a complete rewrite of the module that leverages the new entities system and the States API. Not ready for use on production sites yet." So I feel like I'd be really dumb if I put this on a production site and something broke, when the module project page itself specifically tells me not to.

The other option seems to be Field Conditional State, but that's used on a total of 274 sites (compared to the ~18,000 of Conditional Fields).

Are there any other D7-compatible modules that allow forking of field display based on the value of another field?
If not, how stable is Field Conditional State?
Should I just suck it up and write a module that does what I'm wanting?

Many thanks.


texts: "Create a new account for an anonymous order" Rule issue with required field

texts:
I am using Drupal Commerce.
I have enabled the anonymous user to access checkout and place an order.
There is this rule available in Drupal commerce("Create a new account for an anonymous order") that creates an account for user's who do not have an account and checkout anonymously.

The Problem is that there is an image field which is required in the user account form. So due this, it is having issue creating a new user, as I am not able to supply a value to it. I have set a default image, but its still having the same issue.

Anyone knows how to set this default image or make it non-required to add image while creating account through rules?

?


texts:
I need to add a custom metatag to D7 site, something like here: http://groups.drupal.org/node/83069. What are the possible options? I know there is a metatag module, but seems it doesn't support custom tags.

I could modify the theme, but I need some user configurable solution.


texts: How can I show referenced terms on other term page with view

texts:
My web site has two vocabularies for event content type.
Vocabularies: City and Dance School.

School terms use city terms.
I want to show school terms as a list on city term page
( Eg. Newyork Dance Schools).

My city url is ../city/newyork/145

145 is term id.
I changed city/newyork url to /city/newyork/145.But it didn't work.

I tried many combinations with views & Conceptual filter&relationships but no result.

I tried this but empty results.(https://drupal.stackexchange.com/a/74605/88821).

I'm stuck on how to handle it. Any advice please..Thanks


texts: I want to use Views to show a vocabulary that has field added to another vocabulary, is that possible?


texts: How can I create a custom form settings to my custom field formatter?

texts:
I need to add form settings to my custom display format, can you provide me with an example?

To be clear I just want to add some fields to the format settings form.


texts: Upload zip & unzip to multiple image field

texts: I am using drupal 7 and I want to upload a zip file and automatically extract it into multiple image fields on a node. The zip file contains images. Is there a easy way to do this? cause I'm not a programmer


texts:
I have a lot of views that need a content type filter which I should select about 20 content types for each of them.
Is there any module to categorize content types(not contents)? For example adding a taxonomy term named news to content types news, image news,.. so instead of selecting content types I will add the filter content typs has tag news.


texts:
I have tried to create a custom entity in Drupal. It is working fine for now, but a lot of work needs to be done. I want the fields in the base table of the entity and the fields that I have added from the manage fields to be shown in the View Creation UI.

I tried to Google and found that I have to use the EntityDefaultViewsController but it is not working.

I have attached the module that I tried to create.

Any suggestion will be of great help.


texts: Corresponding entity references: two way sync

texts:
I have two content types containing a reference to each other. When I update the reference on the node of the first content type, I want the reference on the node of the second content type to be automatically updated. Is this possible?

I used the CNR module in Drupal 7, but that's no longer supported.


texts: Commerce Recurring framework with customizable products

texts:
I understand that one of the field's from the recurring framework need to be part of the product and by extension a rule needs that to create a recurring entity by getting the products that have recurring field in them.

I had added the recurring field in the line items types that are of the type add to cart, so that the customer can pick what kind of recurrence they want instead of adding it to the product. These type of fields do not get picked by the Get Recurring Product action in the rules and no recurring entity is created.

Any advice on how to make this work so customers can decide the period rather than the store providing different subscription options by creating that many products?


texts: getting around recursion when dumping a node?

texts:
I'm working on a template and I'm using kpr() from devel to look at the values defined in $variables. One of them is the node in question, and what gets displayed is a big infinity sign indicating recursion.

Is there any way to get around this to have a look at what data I actually have available in the node object?

What is it in the node that creates the recursion?


texts: How to make SASS/SCSS Module works with Drupal 7?

texts:
I've installed SASS/SCSS module within drupal seven... There is no configuration page apart from activating debug, and development mode. So, I thought there will be no other configuration needed. I've created my .sass files in the css directory... but nothing happens...

Could anyone helps?


texts: Mobile switch more than is mobile is not mobile

texts:
D7
I am using mobile switch with panels to display different views for different devices, but the only options I see are is mobile or is not mobile. On bigger devices like tablets I would like to display something other than what I would show on mobile phone. Is there any way I can get more option in mobile switch?


texts:
The Gmap location field marker is located by default at the center of the map.
How can change that ?
I want the center of the map to be calculated according to the value that i have entered.
For example : Lat: 33.5 Long: -70.2

I want the center's coordinates to be Lat-x , Long - y .


texts: State field in Civicrm profile display as digit

texts:
I'm using D7, with CiviCRM 4.4.6. I had use civicrm to create a profile, for user to enter and edit their billing address in their account.

The country, displaying well as "Malaysia", but the state field is displaying as digit, "07".

Is there any way that I can display the state name, just like the selected name in drop down when editing state field?


texts: Custom template for fields in user profiles

texts:
I'd like to customize the fields in my user profiles. So far I've created field.tpl.php which of course applies to all fields on my whole website and not only to the fields in the user profiles.

How do I have to name the field.tpl.php? Is it field--user-profiles.tpl.php? That didn't work.


texts: How do I get the fields of a user object

texts:
I want to know all the fields of the object returned by user_load().

I can analyze it while the site is running with var_dump(), but I want to see the fields without running Drupal, say by opening any (.module) files.

In general, how can I see the object fields of standard objects?


texts: FeedsHTTPFetcher: how to parse object to get source url?

texts:
I've got several content-types based on imported RSS feeds (Feeds import, Simple Pie library).

In a Views pre render, I try to display an information stored in $row->node_feeds_item__feeds_source_config that looks like this:

a:1:{s:16:"FeedsHTTPFetcher";a:1:{s:6:"source";s:38:"http://www.as-e.be/agendas_rss/rss.xml";}}

How can I just get the http://www.as-e.be/agendas_rss/rss.xml part of that object? I have no idea how to parse that.


texts: Attach jQuery behavior to AJAX loaded content

texts:
I would like to add some jQuery behavior to a page using the FAPI #ajax behavior (a Commerce product reference add to cart form)

I used a custom module (Commerce Taxonomy Field Product Attribute) to replace the standard text output of the taxonomy term attribute by an image, and hide the radio button of the add to cart form via CSS (display: none). The goal is to let the user click on the image label to select his product's color or size.
See a screenshot without css, and with css

I added some custom jquery that adds a "hover" and "selected" class to the label (on mouse over and clicked event) in order to have a ui feedback via CSS - as the Commerce add to cart form uses radios element, there is no "hand" mouse pointer on hover, which can be quite disturbing for the UI.
--> It works fine the first time the page is loaded but doesn't get attached when a product is reloaded by ajax.

I have a JS file with

Drupal.behaviors.custom_danity_afficheur_produit_label_hover = {
  attach: function (context, settings) {
    //All the code that attaches the click / hover event functions using jQuery.once()
  }
}

I tried loading the JS file at different level :

in the template .tpl.php file
in the add to cart form alter hook in
a function callback on the add to cart form #post_render attribute

None of these work, the AJAX only works the first time it is loaded.

It's not the first time I try to add jQuery code to an ajax loaded content - I managed last time to modify the code and use FAPI Ajax to make it work - but here i don't know how to do it as the product attributes already have an Ajax behavior implemented by Commerce... and as far is i know, it's not possible to attach multiple ajax behavior to an element with Drupal FormAPI

Any help would be much much much much much appreciated :-)


texts:
I have a Netrunner Card content type. (It's a card game I play.) I have a "field_card" field that holds the card image.
In the node--netrunner-card--Runner_Identity_Card--full.tpl.php file, I am trying to control the output of each field. Instead, I seem to just be dumping the same fields on the screen.

I tried using the following code.

<img src="<?php print render($content['field_card'])?>" />

It scattered the HTML, because the output of render() is the HTML.
What is the standard practice for doing what I am trying to do?

I'm trying to theme the output of each card to make it look like I want it to be, and to learn the theming engine for Drupal.


texts: Render checkbox in a table row on click of button with #ajax property

texts:
I have a form element in hook_form as below,

$form['check'] = array('#type' => 'checkbox',);

and also an add button, on the click of which a table renders, with a checkbox in every row each time the button is clicked. This is how its rendered in ajax callback function,

$header = array(t('checkbox'));
$rows[] = array(drupal_render($form['check']));

My question is in the submit function of the form, when I print the form_state values of the form, I am getting the value of the checkbox as 0 even if it is checked.

Kindly reply. I am trying this from many days.


texts: Is it possible to combine RSS feeds and other stories in the same view?

texts: I subscribe to an RSS feed I would like to post in the same view as some user-generated stories and I would like both types of content to display as a uniform list. Can that be easily done?


texts: composer-install of Drupal8 creates a tmp####/ folder. How to manage & clean it?

texts:
I'm working with Drupal, with v8, using Composer to install & manage it.

I create a new Drupal8 project using the 'drupal-composer/drupal-project' template,

composer create-project --keep-vcs --stability dev --no-interaction drupal-composer/drupal-project:8.x-dev mysite

That installs

tree mysite  -L 1
    mysite
    ├── composer.json
    ├── composer.lock
    ├── drush
    ├── LICENSE
    ├── phpunit.xml.dist
    ├── README.md
    ├── scripts
    ├── tmp12972441691459034756
    ├── vendor
    └── web

If you look inside that 'tmp#' folder

tree mysite/tmp12972441691459034756 -L 2
    mysite/tmp12972441691459034756
    └── drupal-8.0.5
        ├── autoload.php
        ├── composer.json
        ├── composer.lock
        ├── core
        ├── example.gitignore
        ├── index.php
        ├── LICENSE.txt
        ├── modules
        ├── profiles
        ├── README.txt
        ├── robots.txt
        ├── sites
        ├── themes
        ├── update.php
        ├── vendor
        └── web.config

it looks like a complete copy of the source.

Afaict, it's used only on the first install, and doesn't ever seem to get cleaned up or deleted (by cron etc).

Do I need to keep those files around for some reason?  Or is it safe to just delete that folder?

Is there a Drupal8 maintenance task, maybe cron, that should be cleaning it out?

I've read older comments on this, and there's references to old versions' "/tmp" usage, but this is not that I guess, and this has a hash.  Anyway, I don't see the Drupal8-specific usage instructions anywhere.


texts: Load a variation (or Line Item) based a previous choice

texts:
I asked this similar question already (Variations price adjust based on previous variation), but I am thinking to make the solution more 'base'.

Is there a way to 'load' different fields based on a selection of a previous field?

If I select 'Size: Medium', I want to load those colors and styles that have a different price than 'Size: Small' has.


texts: Implement Field API Pane Editor into Views

texts: I have a View which shows nodes from a content type. I need user to be able to edit only one field from these nodes. I installed FAPE module and read its instructions but cat figure out how to implement it into views. I can't ever find out how links should look. Any help would be appreciated. 10x


texts: Display NOT a title field in Entity Reference field but my own field

texts:
By default 'Entity Reference' field uses 'Title' field to resolve Nodes.
Is there any good way to change that behavior so it use another field to do that?

What if I want to use URL field or my own custom field what should I do?

I just would like to know what are the good ways to do that.

Thanks.


texts: Where can I start debugging php for the user/create action in the Services module?

texts:
I'm trying to create a user via the REST API. I was able to do it successfully using the REST Client Firefox plugin, but when I actually try to call the URL via code, I get no response. No errors, just nothing. I'm trying to debug the PHP (I am a PHP developer), but cannot for the life of me find the point where the code starts.

I'm doing something like this:

$('#download_trial').click(function() {
            // also need to create email; can we call rest/user/register from here?
            var name = $('#mail').val();
            $.ajax({
                url:site_url + 'rest/user/token.json',
                type:"POST",
                contentType:"application/json; charset=utf-8",
                dataType:"json",
                success: function(data){
                    mytoken = data.token;
                     var data = {
                                "mail":name,
                                "account":{
                                   "name":name,
                                   "pass":generatePassword(),
                                   "mail":name
                                }
                             };

                    $.ajax({
                        url:site_url +'rest/user/create.json',
                        type:"POST",
                        data:data,
                        contentType:"application/json; charset=utf-8",
                        headers: { "X-CSRFToken": mytoken },
                        dataType:"json",
                        success: function(data){
                            console.log("created user");
                            console.log(data);
                        }
                      });
                }
              });

        });

The rest/user/token.json call is working correctly; I'm able to console.log the token that's returned. But from there, it doesn't seem to be hitting the create.json function as far as I can see.

I've tried adding a watchdog statement to the _user_resource_create function in user_resource.inc, but it never seems to be getting there. What is the initial entry point for the PHP when rest/user/create.json is called, so that I can try debugging it via my IDE debugger?

FYI, this is so that a visitor (non-authenticated user) can create a user account on our system from an external system. Do I need any unusual permissions to allow this?


texts:
I have relatively simple issue but I can't fix it myself.

My log is full warning with same message:

page not found
http://mywebsite.com/sites/all/themes/bigwig/font/entypo-icon-font.woff

I have looked around and most of suggestion is about .htaccess and I tried to add such block (but no luck).

<FilesMatch "\.(ttf|otf|eot|woff)$">
  <IfModule mod_headers.c>
    Header set Access-Control-Allow-Origin "*"
  </IfModule>
</FilesMatch>

I have tried to access other files in folder via browser and everything worked except the one with *.woff

http://mywebsite.com/sites/all/themes/bigwig/font/*

What else can I try?


texts: Speed difference between db_select and EntityFieldQuery

texts:
Is there any performance difference between db_select and EntityFieldQuery?

I would like to re-write portions of the site removing db_select in favour of using EntityFieldQuery.

I hope that i will able to replace few db_select calls with one EntityFieldQuery call, also.


texts:
Recently, I signed up with the Amazon's Lightsail service that comes with a version of Drupal (8.3) provided by Bitnami. I am not sure how this is different from any other installations, but when I tried to increase the font size of my site name, it wouldn't work.
The file I updated is style.css under ~/apps/drupal/htdocs/themes/zircon/css. (I am using the Zircon theme.)
The CSS ruleset I added is the following.
.site-name {
  font-size: 30px;
}

I tried clearing the cache, unchecking the "Aggregate CSS files", but none of them works.
Googling, I learned that adding a sub-theme is recommended for the job, that I tried, but the admininistration pages of the site simply wouldn't load after I created a folder (with the .yml file in it) under the themes(~/apps/drupal/htdocs/themes) directory.
Is it still possible to update a given style.css file from a given theme?


texts: How to automate the replacement of special characters in URLs?

texts:
The standard behavior (*) for friendly URLs in Drupal is replacing special characters by a hyphen in the friendly URL.

For instance,  without any input from the user, versão becomes vers-o and  conteúdo becomes conte-do. However, we need the character to be replaced by their corresponding non-accent ASCII values, such as versao  and conteudo.

Currently, we manually edit the URL when creating content. Is there a way to automate it?

(*): I assume it's out-of-the-box behavior, but this Drupal instance had modules installed and configured by other persons, maybe it's not a default behavior.


texts: Is it possible to make admin toolbar partially visible to newly created users in Drupal 8? For example, the user would be able to observe the Reports, but not be able to add new modules, so the 'Extend' entry is not visible to him?


texts: How can I loop through a multivalue field's values?

texts:
I have two authors for the same blog, so I want to display both authors details on a page. Below code will display only one because $node->field_author[LANGUAGE_NONE][0]['target_id'] contains 0. So next author value will be like this $node->field_author[LANGUAGE_NONE][1]['target_id'] So how can I use foreach loop here to display both author details?

if (isset($node->field_author[LANGUAGE_NONE][0]['target_id']) && is_numeric($node->field_author[LANGUAGE_NONE][0]['target_id'])) {
  $nid = trim($node->field_author[LANGUAGE_NONE][0]['target_id']);
  $nodeauthor = node_load($nid); //$node->type = 'poll';
  if ($nodeauthor) {
    $nodeView = node_view($nodeauthor, 'teaser');
    print drupal_render($nodeView);
  }
}


texts:
So I basically have a custom module created and I just want to know how I can limit the users who can access the 2 forms I have by predefined roles -- the IT and Facilities roles that I have defined in Drupal (7) already so that only IT and Facilities people can access them..

I've been looking at access callback/access arguments but I'm not exactly sure what to use in my form definition/hook_menu in order to limit access to just those two roles.

Here's my hook_menu function:

//hook_menu
function ibbr_inv_menu(){
    //'Inventory Items' page
    $items['inventory_scan'] = array(
    'title' => 'Inventory Items',
    'page callback' => 'ibbr_inv_menu_page_callback',
    'access callback' => TRUE,
    'page arguments' => array(1, 2),
    'type'=> MENU_CALLBACK,
);
    //'Add new item' page
    $items['inventory_scan/add_item'] = array(
    'title' => 'Add new item',
    'page callback' => 'ibbr_inv_add_new_item_callback',
    'access callback' => TRUE,
    'page arguments' => array(1, 2),
    'type'=> MENU_CALLBACK,
);
return $items;
}//end hook

Thank you!


texts: Drupal 7: Views RSS module - fields not showing up

texts:
So I wanted to create a custom RSS feed for my site and was told that I could use the views fields capability with this module: Views RSS. I downloaded and installed and followed the steps explained here for the basic usage. And also took a look at the minimal instructions given at the module's doc

The problem is I end up with; the fields getting picked up by the page display but the feed display returns the default with title and body fields only (regardless of other fields). Also the XML is not outputted correctly and the link. It's as if the Views RSS is not there or is not doing anything.

I have no idea why it is not working...I am think if the steps I followed aren't correct and when I try to follow what is described here I run into the same error and have no idea how the person who posted that solved it.


texts: In D7 what is the correct way to create a page template that has HEAD elements specific to that page?

texts: In Drupal 6 HEAD tags were part of the page.tpl.php.  Now that that has moved to the html.tpl.php in D7, what is the correct way to create templates that need different data in head tags?


texts: Creating an "unzip" module that can interface with Content created through the GUI and through node.create by was of Services module (Drupal 7)

texts:
I am creating a website that will allow users to upload projects.  Project submissions will consist of a couple of text fields, a screenshot and a .zip file.  Once the user uploads their project, I need to unzip the .zip file and catalog its contents.  Also, it needs to be possible to upload these projects through the web interface "Add New Content" and through Node.create by way of the services module.

So my first question, is there a way to hook up a module that will be triggered after a content type is created?  I built my project content using the built in Drupal 7 CCK editors but I see no way to hook up some code to this that could unzip my file and then do whatever else needs to be done.

Now if the above is not possible using CCK does that mean I need to recreate this content type by making it into its own module?

Finally, where would be the best place to put this unzipping code?  I could see it might be cleaner to make a standalone module for unzipping but might it be easier to put this code directly in the content module (if I have to make one)?


texts:
Can I set value like Settings::set('some-variable','hello')?

As if we can get value using Settings::get('some-variable') then why the 'set' method is not working?


texts: Rules compairing node with other nodes when created and fill in a field of both nodes depending on the values

texts:
I have been looking for more then a week to do this kind off stuff.

there is a content type with 3 kinds of fields
field A value can be a b c
field B value can be x y z
field C value can be 1 2 3

depending of someone creating a content of the same type and
he fills in the same values as someone else does.
That rules (or anything else) adds the value in a field D what was empty
a groep ID/name on both nodes.

the is just an example, but the project is way bigger and atm
im only struggeling with this kind off stuff and i really have
no idea.

thanks in advance
greets


texts: How to edit a node programatically after it has been created?

texts:
My articles have a field 'Ranking' and I'd like to give a value to this field after a node has been created. The value depends on the node's ranking in a view called 'Top 3'. I tried the following in my custom module 'Top', but it doesn't work.

function top_node_insert($node) {
  $top = views_get_view_result('top_3');

  $found = false;
  foreach($top as $key => $value) {
    if ($value->nid == $node->nid) {
        $found = true;
        break;
    }
  }

  if ($found) $ranking = $key + 1;
  $node->field_hoogste_ranking[LANGUAGE_NONE][0]['value'] = $ranking;
}

What did I do wrong and what's the correct version?


texts:
I want to change the menu button on my main nav bar depending if the user is or isn't a member of a group.

I need one button to 'register' if the user isn't part of a group and that same button changes to 'add post' if he/she is.

I do not know what to put in the array. Do I put an IF statement similar to "Correct way to use hook_menu_alter"?

   function change_menu_menu_alter(&$items) {
     $items['/node/[nid]'] = array(
       'access callback' => 'change_menu_custom_menu_access_callback',
       'access arguments' => array(1),
       // **I don't know what goes here!!!**
     );
       return $items;
   }
   function change_menu_custom_menu_access_callback($gid) {
     return og_is_member('node', $gid);
   }

EDIT: I do not have gid in my url as I am using pathauto to use [node:content-type]/[node:title] on my URL which is why I don't think the current answer works on my website.


texts: disabled="disabled" on a checkbox entity field

texts:
I can't seem to figure out how to make checkbox field on my entity display as disabled in the admin form area. Looked in Drupal 8s "documentation" but couldn't seem to find anything on it.

I tried variations on the code below but nothing seemed to work. Any help is appreciated. Thank you.

$fields['some_field'] = BaseFieldDefinition::create('boolean')
 ->setLabel(t('Some Field'))
 ->setDescription(t('A Field description'))
 ->setReadOnly(TRUE)
 ->setRevisionable(FALSE)
 ->setDefaultValue(FALSE)
 ->setDisplayOptions('form', [
   'type' => 'boolean_checkbox',
   'attributes' => array(
    'disabled' => true,
   ),
   'weight' => 0,
]);


texts:
I am using Context with Delta and Omega3. I am trying to make the Drupal Commerce Checkout, Review and Complete pages each appear differently.  These are their default paths:

checkout/*
checkout/*/review
checkout/*/complete

The problem is that if you set a condition path to 'checkout/*' in one context then the 'review' and 'complete' condition paths will both be overridden by it.

Is there a way to get separate contexts for each of the 3 pages?


texts: Define ckeditor add media library location

texts: we're currently using ckeditor successfully, but when i go to add media from the library tab it loads up all media, we want to exclude profile images from this, is it possible to define the ckeditor library path, or would we really want to move the profile images to private directory


texts: In the exposed filter form of a view, I have a taxonomy term selector set as a drop-down (you know, an HTML <select>). By default, that dropdown includes all of the taxonomy terms in the vocabulary. Is there a way to limit the terms shown to only those that will return results (i.e. only show the terms that have been used)? Basically, I want to ensure that any of the available terms will return at least one result.


texts: use smtp to programmatically send an email

texts:
i am trying to replace the below smtp client with a fake smtp server, in order to use it for dev purposes. I am using the https://www.drupal.org/project/smtp, but whatever i tried failed. In the body of the mail message, i include html also.

How would you suggest i edited below code, in order to be able to send the emails through the drupal smtp mechanism? I have set the smtp server details in the smtp module settings.

function send_email($data, $simulate = 0) {

    $kok = '';
    if ($data['p_nid']) {
        $pon = node_load($data['p_nid']);
        $kok = node_load($pon->og_group_ref['und'][0]['target_id']);
        if ($pon->field_wrong_email['und'][0]['value']) return 0;
    }
    if ($data['l_nid']) $kok = node_load($data['l_nid']);

    $gid = $kok->nid ? $kok->nid : $data['gid'];

    //create the senddata array
    $send_data = [
        'sender'    => $data['from'],
        'to'      => $data['to'],
        'subject' => $data['subject'],
        'htmlContent'    => $data['message']
    ];

    //attaching files if exist
    if (is_array($data['attachments'])) $send_data['attachment'] = $data['attachments'];
    if (is_array($data['files'])) {
        foreach ($data['files'] as $file) {
            $name = str_replace('.log','.txt',drupal_basename($file));
            $send_data['attachment'][] = ['content'=>base64_encode(file_get_contents($file)), 'name'=>$name];
        }
    }

    //from
    $str = $kok->title;
    if (mb_substr($str,0,68) != $str) {
        if ($kok->field_email_from['und'][0]['value']) $str = $kok->field_email_from['und'][0]['value'];
        else $str = mb_substr($str,0,68);
    }
    if (!$data['from']) {
        $send_data['sender'] = ['email'=>'someemail', 'name'=>'name'];
        if ($kok->nid) {
            $send_data['sender'] = ['email'=>'someemail', 'name'=>str_replace(',',' ',$str)];
        }
    }

    //reply-to
    if (($kok->nid) and ($kok->field_email['und'][0]['email'])) {
        $send_data['replyTo'] = ['email'=>$kok->field_email['und'][0]['email'], 'name'=> str_replace(',',' ',$str)];
    }
    $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'APIKEYHERE');
    $apiInstance = new SendinBlue\Client\Api\SMTPApi(
        new GuzzleHttp\Client(),
        $config
    );

    $sendSmtpEmail = new \SendinBlue\Client\Model\SendSmtpEmail($send_data);

    if (!$simulate) {
        try {
            $result = $apiInstance->sendTransacEmail($sendSmtpEmail);
            $msg_id = $result->getMessageId();
        } catch (Exception $e) {
            echo 'Exception when calling SMTPApi->sendTransacEmail: ', $e->getCode().' '.$e->getMessage(), PHP_EOL;
            $err_msg = $e->getCode().' '.$e->getMessage(). '   l_nid='.$kok->nid.' '.$kok->title.' p_nid='.$data['p_nid'].' email_to='.$data['to']['email'].' '.var_dump($send_data);
            watchdog('sendinblue',$err_msg,[],WATCHDOG_ALERT);
            $msg = $e->getMessage();
            $pos = strpos($msg,'response:');
            $json = substr($msg, $pos+9, 1000);
            $json = json_decode($json);
            if (is_object($json) and ($json->message == "email is not valid in to")) {
                $pon = node_load($data['p_nid']);
                $pon->field_wrong_email['und'][0]['value'] = 1;
                node_save($pon);
            }
        }
    }


texts: Search api excerpt are empty in the result

texts:
I have installed search api module in drupal 8 and included excerpt in the search result.

But excerpt are always empty in the search result. (HTML div element is there but no content inside)

I searched in the forum and enabled the 'highlights' from settings as suggested.
But no changes in the result (I cleared the cache)

Am i missing anything?


texts: Views : Make a block related to a page (with flag/addthis/privatemsg as fields in this block)

texts:
It's difficult to explain but i'll try to do my best.

I have a basic views (Page) with all my fields displaying.
My purpose is to take some of this fields to display them in a block(on the left sidebar)

This fields i want to display in a block are:

Flag: bookmarks
AddThis: Toolbox
Private msg (send message to the author)

I follow all the screemcast "Taming the beast" (from nodeone.se) especially part 24 when Johan Falk explain how to make a block with a related content to a page (without using page manager)

When i go to my article my url is like that: /fiches-produits-services/100  (100=>[nid])

I follow this step when i create my block:

Add my fields etc.
Add contextual filter : content: nid
click on it, go to WHEN THE FILTER VALUE IS NOT AVAILABLE
Click on Provide default value
Select Content ID from url

But after that nothing, the block isn't here.
When i click on Display all results for the specified field on the same section, the block appears but with all the flags, the privatemsg and socials icons from all my article.

It's not the bahavior i want, i would like to have just the flag related to the article, just the link from private messages related to the article etc.

I don't know if i missed something. In the screemcast he did that with content(article) related with another content (basic page), maybe we can't do that with flag, addThis or privatemsg because it's not really a content (But i don't really know i'm new).

So if someone can help me to understand that, i'll be very grateful.


texts: No page content displaying on front page

texts: When I go to set my Drupal 7 site's front page (Administration » Configuration » System » Site information) to a basic page that I've created, and then load the front page, nothing is displayed in the content section on the front page except for the site's header (masthead, navigation, search, etc.), footer, and sidebar for that page. Basically, the content of the page won't display when it's set to be the front page. It displays fine when it's not the front page. What gives?


texts: How can I change the site settings email using Drush?

texts:
Env: D8/drush-9.5.2

I need to use drush to change the site details (Home->Administration->Configuration->System)
Site name, Slogan, and Email address.

I found the configuration key by running: drush -y config:get system.site
uuid: 9426274f-17fe-491a-b5c9-xxxxx
name: oldname
mail: oldname@oldAddress.com
slogan: 'old slogan'
page:
  403: ''
  404: ''
  front: /node
admin_compact_mode: false
weight_select_max: 100
langcode: en
default_langcode: en

I can accomplish the first two:

drush -y config:set system.site name '*NewSiteName*'
drush -y config:set system.site slogan "*A New Site Slogan*"

but drush -y config:set system.site mail 'example@example.com' has not worked!

Any help or ideas appreciated.


texts: Getting the entire index of nodes from REST API

texts:
I'm looking for a way to get all the nodes to be shown on my REST service.
When I query the endpoint index http://server/api/node it only returns 20 results. Are there any additional parameters I can send along to unset this limit?

I would be really thankful for a quick answer. I have been spending a couple of days now to get the REST service in Drupal to work the way I need it to work.

P.S. I'm on Drupal 7


texts: CAS username field value to be manually added to the existing user on import?

texts:
I installed the CAS module on a Drupal 8 site, and it is working fine. For new users, it auto-registers the user with cas_username, but I would like to import the cas_username manually for the existing Drupal 8 user.

I also tried importing users in CSV format; I have been able to add the $account(row[0],row1), but for the CAS username import, i don't know how to import it, and in which field is stored.

'uid' => NULL,
'name' => $username,
'field_first_name' => row[0],
'field_last_name' => $row[1],
'pass' => $username,
'mail' => $row[2],
'status' => 1,
'created' => REQUEST_TIME,
'roles' => array_values($config['roles']),

I tried Managing CAS username; the suggestion given is for Drupal 7, but the same method doesn't work for Drupal 8.

How do I import the CAS username in CSV?


texts: Location Proximity Search using db_select in Custom Module

texts:
I want to build a custom block which uses the nid of the node it's visible on to pull in nodes within a radius of 50 miles based on it's geolocation. I am using the location module and gmap where doing this query in views is easy but I have no idea where to even begin in building this query in db_select.

this is what views is outputting for the same query:

SELECT node.title AS node_title, node.nid AS nid, (COALESCE(ACOS(0.61832265427253*COS(RADIANS(location.latitude))*(0.99735883206175*COS(RADIANS(location.longitude)) + -0.072631674277943*SIN(RADIANS(location.longitude))) + 0.78592435718291*SIN(RADIANS(location.latitude))), 0.00000)*6364902.7458257) AS location_distance_sort
FROM
{node} node
LEFT JOIN {location_instance} location_instance ON node.vid = location_instance.vid
LEFT JOIN {location} location ON location_instance.lid = location.lid
WHERE (( (node.nid != '3849' OR node.nid IS NULL) )AND(( (node.status = '1') AND (node.type IN  ('weather_reports')) AND (location.latitude > '51.081897505891' AND location.latitude < '52.530604494109' AND location.longitude > '-5.3366374087818' AND location.longitude < '-2.9936745912182') AND ((COALESCE(ACOS(0.61832265427253*COS(RADIANS(location.latitude))*(0.99735883206175*COS(RADIANS(location.longitude)) + -0.072631674277943*SIN(RADIANS(location.longitude))) + 0.78592435718291*SIN(RADIANS(location.latitude))), 0.00000)*6364902.7458257) < '80467.35') )))
ORDER BY location_distance_sort ASC
LIMIT 1 OFFSET 0

How do i run a db_select query to select the nodes within 50 miles of 51.6599, -3.9215


texts:
I am working on my template and have gotten it laid out almost how I want.

I have it print the content with {{ page.content }} but what I need is on another part of the page I want to print out a specific field from that same content.

I tried different combinations of twig tags but none worked for me.

{{ page.content.field_name }}
{{ content.field_name }}
{{ item.field_name }}
{{ field_name }}
and a few others

I tried googling but I didn't find anything.


texts: Ubercart alter product price when product added to cart

texts:
I need to alter Ubercart product price on Ubercart 3, Drupal 7, when product is added to cart.
I need to check some conditions, and if met, change the price. I thought i can go with

function MYMODULE_uc_cart_item($op, &$item) {
  switch ($op) {
    case 'load':
      drupal_set_message(t('It works!'), 'status');
      break;
  }
}

but not sure am i targeting right hook.

It seems that it does not work (it is not invoked).

Thanks for clues


texts:
I want to change the appearance of the Drupal 7 search form.  I used this code in my preprocess-html.inc file for my Omega subtheme.  It didn't work.  How do I assign html classes to divs within the Drupal 7 preprocess-html.inc file?

Here's what I put in that didn't work:

<?php

function mythemename_form_search_block_form_alter(&$variables) {
  // custom functionality here

}

?>

            <input type="text" class="form-control" placeholder="Search for...">

            <button class="btn btn-default" type="button">Go!</button>

To clarify, how do I add this bootstrap html code to the template file? I need to add these classes to the search form.


texts:
On this page :

https://dev.s1biose.com/profil

There is a menu at the top right. It flashes green when the .views-exposed-form class is found with this JS code:

  if ($("#navbar-collapse-second .views-exposed-form").length) {
       $("#block-togglenavigationsecond .icon-navbar-second-alert").removeClass("icon-navbar-second-alert-disable");
  };

When the BigPipe module is installed, the animation does not work (under dev domain).

Here is my site with BigPipe uninstalled (under www domain):

https://www.s1biose.com/profil

The problem is that I do not see any difference in the HTML code.

Why does not the animation work with BigPipe ?

It must work on all browsers. But BigPipe creates problems on some web browser.

Thank you

Here is the complete JS file for my animation:

(function ($) {
  'use strict';

  $('#navbar-collapse-first').on('show.bs.collapse', function () {
       $('#navbar-collapse-second').collapse('hide');
  });

  $('#navbar-collapse-second').on('show.bs.collapse', function () {
       $('#navbar-collapse-first').collapse('hide');
  });

  $('#navbar-collapse-first').on('show.bs.collapse', function () {
       $('body').addClass('overlay-is-navbar-collapse');
  });

  $('#navbar-collapse-first').on('hide.bs.collapse', function () {
       $('body').removeClass('overlay-is-navbar-collapse');
  });

  $('#navbar-collapse-second').on('show.bs.collapse', function () {
       $('body').addClass('overlay-is-navbar-collapse');
  });

  $('#navbar-collapse-second').on('hide.bs.collapse', function () {
       $('body').removeClass('overlay-is-navbar-collapse');
  });

  $('#navbar-collapse-first .form-submit').on('click', function () {
       $('#navbar-collapse-first').collapse('hide');
  });

  $('#navbar-collapse-second .form-submit').on('click', function () {
       $('#navbar-collapse-second').collapse('hide');
  });

  $('#navbar-collapse-first .navbar-nav .dropdown').on('shown.bs.dropdown', function () {
       $(this).find('.dropdown-toggle svg').removeClass("fa-plus-circle").addClass("fa-minus-circle");
  });

  $('#navbar-collapse-first .navbar-nav .dropdown').on('hidden.bs.dropdown', function () {
       $(this).find('.dropdown-toggle svg').removeClass("fa-minus-circle").addClass("fa-plus-circle");
  });

  $('.collapse').on('shown.bs.collapse', function () {
       $(this).parent().find('.panel-heading .collapse-change-icon svg').removeClass("fa-plus-circle").addClass("fa-minus-circle");
  });

  $('.collapse').on('hidden.bs.collapse', function () {
       $(this).parent().find('.panel-heading .collapse-change-icon svg').removeClass("fa-minus-circle").addClass("fa-plus-circle");
  });

  $('.bs-tour-action-trigger').on('click', function () {
       $('#comment-ca-marche').modal('hide');
  });

  $('#block-boutonimportant').on('click', function () {
       $('#navbar-collapse-first').collapse('hide');
  });

  $('#block-boutoncharte').on('click', function () {
       $('#navbar-collapse-first').collapse('hide');
  });

  if ($("#navbar-collapse-first .views-manage-menu").length) {
       $("#block-togglenavigationfirst .icon-navbar-first-alert").removeClass("icon-navbar-first-alert-disable");
  };

  if ($("#navbar-collapse-second .views-exposed-form").length) {
       $("#block-togglenavigationsecond .icon-navbar-second-alert").removeClass("icon-navbar-second-alert-disable");
  };

  $('#navbar-collapse-first').on('shown.bs.collapse', function () {
       $(this).find("#block-menuprincipal .dropdown-toggle").dropdown("toggle");
  });

  $('#navbar-collapse-first').on('shown.bs.collapse', function () {
       $(this).find(".views-manage-menu .dropdown-toggle").dropdown("toggle");
  });

}(jQuery));


texts: How to bulk update entities using the Feeds module, without existing mappings to a "unique target"

texts:
Importing new entities with feeds using a published csv file is very handy. I use Google Sheets to publish a csv file and use Feeds to create new nodes, which then can be updated based on a unique target field.

However, I have a number of sites that need their content to be bulk-updated in a similar fashion, but these entities were not imported through Feeds, so no unique target / hash check is present to update them.

Is there a way to make drupal import a feed and check for existing entities using the title field, and modify/populate the corresponding fields?


texts: EntityAPI $controller->view() not working!

texts:
i have created new entity using Model Entity module. Now i would like to have a new page where i can list multiple Model contents.
I have defined new page in hook_menu():

// Menu item for viewing model list of current account
$items['model'] = array(
  //'title' => 'Title',
  'title callback' => 'My Models',
  'page callback' => 'model_list_view',
  'access callback' => 'model_access',
  'access arguments' => array('view', 1),
  'type' => MENU_CALLBACK,
);

And here is definition of function model_list_view()

function model_list_view() {
  global $user;
  $account = $user;
  //Load user models
  $conditions = array('uid' => $account->uid);
  $models = array_values(model_load_multiple(FALSE, array('uid' => $account->uid)));

  // Render models
  $controller = entity_get_controller('model');
  $new_models = array();
  foreach($models as $model){
    $new_model[$model->model_id] = $model;
  }
  $content = $controller->view(array($new_model));
  drupal_set_title('My models');
  return $content;
}

So after this i am getting the following error:

Missing bundle property on entity of type protocol. in entity_extract_ids()

With this function i am trying to get a View which lists the supplied array of models. I would highly appreciate if someone can show whats the right way to render array of contents via View programmatically. I have searched a lot about this but couldn't really find sth that would explain stepwise.

Thanks in advance!


texts:
I have a route with a parameter, e.g. /r/{app_id}. The controller extends ContainerInjectionInterface.  The method either returns a render array or a new TrustedRedirectResponse.

I believe I have a caching problem because subsequent visits to the page will not update even with changing {app_id}.  If I visit from another browser I get the correct response one time.

My controller is, basically, this:

if (!$a) {
  return ['#markup' => 'no'];
}

return new TrustedRedirectResponse($url);

I have tried to disable cache in several ways, to no avail:

addCacheableDependency
putting #cache => ['max-age' => 0] on the render array
\Drupal::service('page_cache_kill_switch')->trigger();
using $response = new Response() and $response->setCache(['max_age' => 0]) and then, from within the conditional, using $response->setContent('blah')

Not having luck with any of the above.


texts: php include inside .tpl.php template file

texts:
I have 2 template files where I want to use a common piece of template code. Is it ok to do an include of the chunk of template code I want to use?

Example model.tpl.php:

include('/path/to/template.php.tpl');
<!-- Other Template Code -->


texts:
I am really getting frustrated with this. In my theme I have a script file that is working. I am adding a new function to deal with some div but nothing happen. Cleared the cache...tried different things...nothing is working.

The following code is working perfectly fine when tested in jsfiddle, but in my site...nothing at all.

html code output:

  title

title

     logo

dsfdsfsdfsdfsdfsdfsdfdfs

in my js script:

$(document).ready(function () {

$(".cal-full").mouseover(function() {

        $(this).siblings('.cal-events-tooltip').addClass('cal-events-tooltip_show');
    $(this).siblings('.cal-events-tooltip').removeClass('cal-events-tooltip_hide');

    });

$(".cal-full").mouseout(function() {

        $(this).siblings('.cal-events-tooltip').removeClass('cal-events-tooltip_show');
    $(this).siblings('.cal-events-tooltip').addClass('cal-events-tooltip_hide');

    });

});

Any help will be appreciated.
Thanks!


texts: Add js file in .info theme file. And set it to load first

texts:
I added this line in my-theme.info

scripts[] = js/my-file.js

The files is loads but in last place. I need it to be loaded before all modules js files.

How can I set the weight?

I also tried (same results) in template.php with:

function MY-THEME_preprocess_page(&$variables) {

  $file =  path_to_theme() . '/js/my-file.js';
  $options = array('weight' => -1000);

  drupal_add_js($file, $options);

}


texts: How to add additional information to shipping methods?

texts:
I have a list of shipping methods added via the UI admin/commerce/config/shipping-methods.

I need to have an accompanying description added to each shipping method.
First I thought that I could add an additional field under the settings for shipping types, but this didn't work (Added the field, but it never shows up when adding or editing a shipping method).

I'm fine if this is only doable programmatically, but I have found absolute zero information on how to do this on drupal 8.
I would actually prefer if I can do it programmatically, as I will be adding my own shipping method plugin in the future.

Question
How do I add an additional field to each shipping method?