texts: File Upload visible in $_FILES but drupal file functions create empty file

texts:
I created a custom form with a file upload field:

$form['csvfile'] = array(
    '#title' => 'CSV File',
    '#type' => 'file',
);

When I submit the form, I can see the correct information in the $_FILES array:

However, when I try to use the code in the examples module to get the contents of that file and write it to an unmanaged file, the file is empty.

So, the resulting file is 0 bytes long.

How do I access the uploaded file in a drupal-y way? I know I can just use the basic PHP functions to access the file, but I'm trying to learn how to do it the way drupal intends.

My submit handler code is almost entirely lifted from the examples module.

function herdapi_form_bulkupload($form, &$form_state) {
    $form = array();
    $form['email'] = array(
        '#title' => 'Owner Email',
        '#type' => 'textfield',
    );

    $form['password'] = array(
        '#title' => 'Password',
        '#type' => 'password',
    );

    $form['csvfile'] = array(
        '#title' => 'CSV File',
        '#type' => 'file',
    );

    $form['submit'] = array(
        '#value' => 'Upload',
        '#type' => 'submit',
    );

    $form_state['rebuild'] = TRUE;
    $form_state['redirect'] = FALSE;

    return $form;
}

function mymodule_form_bulkupload_submit($form, &$form_state) {

    dsm($form_state);
    dsm($_FILES);
    $data = $form_state['values']['csvfile'];

    // With the unmanaged file we just get a filename back.
    $filename = file_unmanaged_save_data($data, NULL, FILE_EXISTS_REPLACE);
    if ($filename) {
        $url = file_create_url($filename);
        $_SESSION['file_example_default_file'] = $filename;
        drupal_set_message(
            t('Saved file as %filename (accessible via !url, uri=@uri)',
                array(
                    '%filename' => $filename,
                    '@uri' => $filename,
                    '!url' => l(t('this URL'), $url),
                )
            )
        );
    }
    else {
        drupal_set_message(t('Failed to save the file'), 'error');
    }
}


texts: Can I use Rules Transform to remove text from a returned value?

texts:
I notice that Drupal Rules Data Transforms has the "trim text" action option. Is it possible to trim the returned value by a specific number of characters, or remove a specific word from the returned string?

E.g. I grab an entity field value with my first action, and I want to remove the word "grams" from the returned value.


texts: Why do we use "target_id" as the name of the index in php instead of "entity_id"?

texts:
I'm finding that while I'm coding that I type in things like $entity->field_fieldname['und'][0]['entity_id'] and that this doesn't work.  When the Drupal 7 developers were developing it, why did they select 'target_id' as the index instead of 'entity_id' (or even better, why not try eid? ) I don't know how to contact the Drupal Coders who made this decision, do does anyone know who made this decision?

Drupal 7 has become quite harder to write code in.

Is there a better way for me to be coding that would avoid this problem?


texts: How to add rel="author" attribute to Drupal 7?

texts:
In the brave new world of Google, great integration with Google+ is mandatory for all webmasters who want to get as much traffic as possible. If adding the rel="publisher" attribute to a website is done with the Meta Tags module, it seems that there's no official way for supporting the rel="author" attribute. For those of you who don't know about I am talking about, read this article from Google: Author information in search results

Apparently support will be included in Drupal 8. I've seen some discussions about adding this to the Drupal 8 core.

But how to implement this in Drupal 7?

I am asking this as a noob in customizing the insides of Drupal. So, if you have some good ideas, please keep this in mind.

Appreciate your ideas.


texts:
I am using HTML Mail module. I have created an html email template specific to my form(webform) in the template folder of my theme directory. My form name is newsletter and the template name is htmlmail--webform--newsletter_email.html.twig

I want to override the email body based on a particular language. But my problem is that hook_mail_alter doesn't work in my case.

Drupal API documentation for  hook_mail_alter says that hook_mail_alter() allows modification of email messages created and sent with MailManagerInterface->mail().

Any help?


texts: I need a way to automatically make Panel layouts responsive

texts:
Before I asked this question I did a humble Google research for several times but I really couldn't find any efficient solution for this problem. I consider a working answer to be a grace with the community:

Until now, I haven't had many panels in my sites (say no more than 1-2 mini Panels + 1 panel page, per site). I made each Panel responsive by per block elements. I must say that could take some time and it's surly not an efficient solution when you have many panels in your site...

Therefore, I am looking for a way to automize this process - Instead of making any panel layout responsive manually, I need a way (maybe even a general CSS code piece if not a module) just to ensure my panel layouts will be responsive, and an example would be:

instead of width: 50%+50% or 33%+33%+33% float\text-align: right\left, all will be centered).

So, how can you to "Auto-responsify" all existing panels, including all panels to come, in a site?


texts: Drupal 8 Bootstrap Theme Background "transparent" (e.g. offcanvas-lining visible)

texts:
I have installed the Drupal 8 Bootstrap Theme (version 8.x-3.0-rc2) on a newly setup site. When I logout and view the page everything looks as I would expect it. But while I am logged in when I click on "Back to Site" in the top left corner then I only see a background ofbackground-color: #333 which is being set by a class named .offcanvas-lining. This makes working with the theme almost impossible because the text and headers have the same color and so the text is invisible.

I could probably override that somehow but I would like to understand if this is an issue with the Drupal 8 theme or if I have made a mistake when I setup the theme.

What is this offcanvas-lining element doing and why am I seeing its background rather then the usual white bootstrap background which is the default.


texts: Change front page url by keeping its content

texts: I would like to change front page url to some string, e.g. http://example.com/pattern and need all url('<front>') links to be changed to the new url and 301 redirect to new url after openening the site directly as well.


texts: How to add watchdog logging to organic groups

texts: I have a Drupal 7 site which makes use of the organic groups module. I would like to add helpful watchdog log messages when users are removed from a group. What are some options? hook_og_membership_delete does not seem to fire.


texts: Can't direct a domain to a working D7 test site

texts:
I've created a D7.29 test site on godaddy's "deluxe classic hosting" plan at www.mybusiness.com/test  and it works great. The site structure is  root\mybusiness\test.      Now I've been trying to copy it to the root and direct a client's web domain to that copy and now all the user gets is the first page (very quickly I might add, like it was a static page) but all links that you click on or when trying to log in just result in "Internal Server Error..."

I then tried to direct the client's domain  www.hissite.com to the original test site's folder at root\mybusiness\test and all it results in is the same error, even after waiting an hour.

I then read about the settings.php option of   base_url = 'http://www.hissite.com';  so I enabled that and still get the same error.  What's wrong?  How come I can't just direct a domain to a working Drupal instance?

Any help would be greatly appreciated!!

Dave N


texts: Drush failing on preflight: A colon cannot be used in an unquoted mapping value

texts:
I can't run drush in my current project. The error I keep getting is:

[preflight] A colon cannot be used in an unquoted mapping value at line 3 (near " in Command line code on line 1").

This is a Drupal 8 project I've recently updated and I'm about to migrate to Drupal 9. I'm running Drush 10.3.1
I've deleted and reinstalled drush, /vendor, and /core.
I'm guessing "Command" should point me to something but I can't figure out what.
Any ideas on how to troubleshoot this?


texts: How to prevent child element to move when parent dropdown?

texts:
I have a div with height:20px with hover. When you put the cursor on it, a menu bar appears, this menu bar have height:50px.

After that i have a second div which is juste a yellow pannel with margin-top: 50px (so it's 50px from the parent who is the first div (that has : height : 20px)).

Now when the hover effect happend, the second div (the yellow pannel) moves down with the droping down effect.

How to make the second div do not have a margin top with the direct first div (his parent) ?

Thank you


texts: Can anyone recommend me a simple twitter module which will enable me to include twitter feeds on my site? I am using a corporate clean theme and would like to display it in the middle column of the footer section.


texts: Show new content count on the taxonomy term list view

texts:
I have a view that lists the terms in a specific vocabulary. I can also mark the terms if there is a new content tagged with this term. My view looks like this:

  Term 1
  Term 2
  Term 3 (new)
  Term 4
  Term 5 (new)
  ...

However, what I would like to achieve is a view that shows the count of the new contents tagged with a term. Like this:

  Term 1
  Term 2
  Term 3 (2 new)
  Term 4
  Term 5 (7 new)

My current views configuration is like following:

Showing taxonomy terms of a specific vocabulary
Added a relationship of Taxonomy term: Content using my vocabulary
Added field Content: Has new content: This has caused duplicate rows for the terms that has more than one new content. For example, if a term has three new contents, it was listed three times. So I did the next step.
Activated Aggregation, and set the aggregations settings of the field Content: Has new content to SUM: This has solved the duplicate rows issue, but it doesn't show the sum of the contents as I actually wanted to achieve.

Is there any possibility that I can show the number of new contents on this view?


texts: How to delete events from Full Calendar?

texts:
I'm using FullCalendar module

I have added an event. Now I want to delete it. How can I remove/delete an event from the calendar?


texts:
I want to have this result with views:

<image src="http://example.com/sites/example.com/files/blank.gif" data-src="http://example.com/sites/example.com/files/image.jpg" data-retina="http://example.com/sites/example.com/files/image.jpg" />

I have a view with hidden image field which formatter is url. I add a global text field in which i add this code

<image src="http://example.com/sites/example.com/files/blank.gif" data-src="{{ field_image }}" data-retina="{{ field_image }}" />

But it doesn't work. I only have this on the code source of my page

<img src="http://example.com/sites/example.com/files/blank.gif"> "http://example.com/sites/example.com/files/image.jpg" data-retina="http://example.com/sites/example.com/files/image.jpg"/>"

What am i doing wrong??

Thank you for your help.


texts: Why isn't my Sub Theme's CSS file showing up?

texts:
I created a sub theme which is intended to just have a few color changes and background image changes.

The Base theme is called limon. The sub theme is limon_orange. In the sub theme, i have a unique style sheet that I want to use to override the base theme styles via cascade. In the limon_orange.info file I have this  line:

stylesheets[all][] = orange.css

The sub theme works, but orange.css is never used. What am I missing? Why is orange.css not loading?


texts: How can I programatically add a shipping method to a store?

texts:
I am using Commerce with Marketplace, and am using the Shipping module.
In my commerce marketplace, users become sellers via a custom form, where I create the store entity on submit.  Currently, to attach a shipping method, it has to be done in commerce admin via a checkbox:

My marketplace can have an unlimited number of stores, making management of them via checkboxes unfeasible.  How can I add a shipping method to a store?  There's a table commerce_shipping_method__stores:

Can I simply make an insert into this table and set the stores_target_id value to the new store id after the new store is created?


texts:
Please i need help in the matter below  :
I want to add breadcrumb to each element of the search results .
I didn't find any option to enable that in the search setting , I'm using the search module of Drupal 7 .
Could someone help me in achieving that?
Thanks in advance !


texts:
I have a node which I want to update from a form states values. I can set each value individually like:

$node->set("foo", "bar");

Is there a way to mass assign the values instead of setting each individually?


texts: Create public or private nodes in groups

texts:
1) On my drupal 8 site, I use the "Group" and "Flags" modules.

How do I create public or private nodes in groups?

if the node is private, it is displayed only to the member of the group.
if a node is published, it is displayed to all users of the site.

Maybe with the module "Flags" it would be possible.

An idea ?


texts: How can I attach multiple pdfs to drupal_mail() function?

texts:
Was doing something like this

        global $base_url;
        $uri = $base_url . '/sites/default/files/test.pdf';
        if(!empty($mail_content)) {
            /*send mail */
            $to =$mail_content['to'];       //gets the current user's mail address
            $from = variable_get('site_mail', '');    //admin's mail address
            $body = $mail_content['body'];

            $filemime = $mail_content['mime'];
            $filename = $mail_content['filename'];
            //$filepath =
            //$filealtname  = drupal_basename($filearray['uri'], $suffix = NULL);

                $attachment = array(
                'filecontent' => 'http://localhost/cando/sites/default/files/test.pdf',
                'filename' => $filename,
                'filemime' => $filemime,
            );

            $mail_content['params']['attachments'][] = $attachment;
            $params = array(
                'subject' => $mail_content['subject'],
                'body' => $body,
                'attachment'=>$attachment,
            );

             // print_r($attachment);print_r($params);exit;
        //  print_r(file_get_contents(DRUPAL_ROOT));die;
            $message = drupal_mail('cando_custom', $mail_content['mkey'], $to, language_default(),$params,$from);

            return 'Mail Sent ... ';

        }
    }


texts: Error: Call to a member function addWhere() on array in hook_views_query_alter()

texts:
I'm getting the error 'Call to a member function addWhere() on array' in my hook.
Any thoughts?
I just need to add WHERE clause to my query.

use Drupal\views\ViewExecutable;
use Drupal\views\Plugin\views\query\QueryPluginBase;

/**
 * Implementation of hook_views_query_alter
 *
 * @param $view
 * @param $query
 */
function MYMODULE_views_query_alter(ViewExecutable $view, QueryPluginBase $query) {
  if ($view->id() == 'search_filter' && $view->getDisplay()->display['id'] == 'block_1') {
    $field = 'node__field_country.field_country_target_id';
    $value = 'somevalue';
    $operator = '=';
    $query->addWhere(0, $field, $value, $operator);


texts: How to send an e-mail to a user selected in a webform via a user reference field?

texts:
I have a webform, that the HR use. I have a form component of the users, that is a user reference field.

I would like to use Webform Rules to send an e-mail notification to the selected user.

If I use: [data:{component}-display], then after the username [1] appears, that refers to the link to the user.


texts: Export node report base on Word and Excel template

texts:
I want to export node content to Word or Excel.
Are there any module to do this?


texts: What is the best way to pass values from one form to another with fapi?

texts:
I have one form that is just an options input.  When I select a value then go to the next page there is another form that I want to have three hidden values based upon the chose value of the first form.

With Form API, what is the best way to pass the value from the first form to the next and have three values from the second form be determined by the single value chosen from the first form?


texts: Choosing between stable and development snapshot releases for a new high trafficked site

texts:
After some research, I am planning to start the migration of a high trafficked site from Pressflow 6 to Drupal 7, as the current implementation (Pressflow 6 + 200 modules) is making it crawl. I've read that most of Pressflow 6 (if not all) performance changes have made into Drupal 7, and that's awesome. I will be starting the project in a day or 2 and I was wondering if I should be starting with the stable version (Jan 5, 2011) or the latest development snapshot.

There is a gap of over 3 months, and I am wondering if I will lose on fixes that made into the 7.x branch in these 3 months (that's a long time for a open source project so popular) and if a new stable release is around the corner.

I would also like to understand the impact on frequency of code updates on drupal core ( in case I use dev snapshot) and ways to manage it properly.


texts:
I would like to add body classes by context depending on the time of the day. One class for the morning, another for the midday, another for evening.
I expected the context date  module to do thatm, but it does not work when I do not put the date in (i.e. it accepts the condition, but there's a bug and the whole condition disappears afterwards).
Any ideas?


texts: Module For Managing Page-Specific Permissions

texts: I am curious if there is a module or a combination thereof that allows one to manage page- or resource-specific permissions? That is, if I wanted to create a Role and lock it to only being able to edit a certain page, how would I go about  achieving that?


texts: How do I change either the text in the views data export CSV button or the button completely

texts: I have a view that exports data, so the csv button is displayed.  I want the button to read "Export" instead of CSV - how can I change the text that displays on that button or display a different button completely?


texts:
I'm trying to get a value of GET variable in hook_preprocess_page(), but I'm having problems with the cache. Only the first time the code is executed, I can get the value of the variable to put it in a cookie; if I try to load the same page with different values, the code doesn't execute.

I need to put this value in cookie to identify the source of leads.


texts:
In a functional test I try to test a functionality after changing the module configuration:

public function setUp() {
  parent::setUp();
  ...
  $config = \Drupal::configFactory()->getEditable('move_file.settings');
  $config->set('vocabulary', 'tags');
  $config->save();
  ...
}

The tested functionality is located primarily in MoveFileService.php. But the service does not see the configs. When I debug the configs directly in the service, then I get:

public function __construct(ConfigFactory $config_factory, LoggerChannelFactoryInterface $logger_factory) {
    $this->config = $config_factory->get('move_file.settings');
    $this->logger = $logger_factory->get('move_file');
}

public static function create(ContainerInterface $container) {
    return new static(
    $container->get('config.factory'),
    $container->get('logger.factory')
    );
}

public function configsAreSet() {
    ...
    fwrite(STDOUT, "Settings: {$this->config->get('vocabulary')}\n");
    // Returns: Settings:
    // The configuration is null.

    $config = \Drupal::service('config.factory')->getEditable('move_file.settings');
    fwrite(STDOUT, "Settings: {$config->get('vocabulary')}\n");
    // Returns: Settings: tags
    // This returns the expected value. But the good practice is to use the dependency injection.
    ...
}

How can I save the config in the setUp() method of the functional test, so that the service can get the saved configuration, when the test is running?


texts: How do I link accounts from a remote IdP to my local Drupal Accounts?

texts:
I'm using using the simplesamlphp_auth module and I've configured a remote IdP in my simplesamlphp config files. At this point, when I'm on the login screen, I see a link to login with my IdP, and the IdP login/2FA flow goes through just fine.

When I'm done, I'm taken back to my Drupal site (the IdP is configured to redirect to /admin/content) but I am not authenticated in the Drupal application. I had set the option to "Synchronize user name on every login" in the configuration of the simplesamlphp_auth module but I guess it's not doing what I thought it would. I also configured it to use the mail attribute that the IdP is supposed to give as the unique identifier.

Ideally what I would like is that only people that can login through the IdP and have a Drupal account with the same email are able to be authenticated. Right now that'll only happen if the user manually logs in again with their local Drupal account after going through the remote IdP.

How can I automatically log in users into their local Drupal account after they have authenticated with the remote IdP, and only if they match the email addresses from both accounts?


texts: How can I get the saved value in the variable table to show on a form?

texts:
I have a form that gets values set in the variable table if any have been submitted. All of the fields work as expected except a radios field, which always shows the default. Here's the relevant code

$one = variable_get('one', array());

$form['one']['visibility'] = array(
 '#type' => 'radios',
 '#title' => t('The title'),
 '#options' => array(0 => t('Yes'), 1 => t('No')),
 '#default_value' => (!empty($one['visibility']))
 ? $one['visibility']
 : 1,
);

I had thought that keying the options array with strings would solve this but it doesn't. I'm still Googling, but I'm wondering if there's something easy I'm missing.


texts:
I'm adding a logo image to my page.tpl.php template this way:

<img src="<?php print drupal_get_path("theme", "my_custom_theme"); ?>/img/logo-mobile.png">

The image is being displayed fine in the homepage, but if I go to the /user page, for instance, the image won't show up.

Any ideas why is that happening?

Thanks!


texts: How do I automatically change the background image of body?

texts:
How do I automatically change the background image of body, when I click on a menu link?

I want to obtain the same effect shown in the Drupal Design Camp Boston 2011 site.


texts: Remove search form from search results page

texts:
I have a search box in a sidebar and I'm happy with it. I don't want Drupal to output another one on the results page. So far I've managed to remove it with the following code

function mythemename_preprocess_page(&$variables) {
    if(array_key_exists('page', $variables)) {
        if(array_key_exists('content', $variables['page'])) {
            if(array_key_exists('system_main', $variables['page']['content'])) {
                if(array_key_exists('search_form', $variables['page']['content']['system_main'])) {
                    unset($variables['page']['content']['system_main']['search_form']);
                }
            }
        }
    }
}

but it doesn't look very clean to me. Is there another way?


texts: I am new Drupal user working on a Drupal 7 site. We have a content type that allows us to add related content in tabs that are aligned down the left side of the page. How do I duplicate (clone?) this content type and make slight modifications?


texts: Someone just told me that in D7, drush rr and drush cc all do the same thing. I can’t find anything that explicitly states the difference, nor can I find anything that supports such a claim. Additionally, I’ve noticed there are some changes that seem to only show up with a drush cc all, particularly changes to code. Do drush rr and drush cc all actually implement the same functionality?


texts: how to enable workflow submodules in Modules administration page

texts: I am a very beginner to Drupal. In order to understand how Drupal-Workflow works, I try to install Workflow Module into my site. Following the installation guide on Drupal Documentation, i place the entire workflow directory into your Drupal modules directory, but when i go to the Modules administration page,  and try to enable the following workflow submodules, i get into the trouble, like this, i couldn't check the submodules. So, who can give me a hand, appreciate enough！


texts:
mysql> select nid, uid, created, changed from node;
+-----+-----+------------+------------+
| nid | uid | created    | changed    |
+-----+-----+------------+------------+
|   1 |   8 | 1336040166 | 1336046390 |
+-----+-----+------------+------------+

I'd like to have an "changed by" column on the node table, exactly as we have a "created by" (the uid field). This would keep track of who made the last change on that node. I know that this could be derived from the node_revision table but this depends on the revisions being enabled for the content types I'm interested.

So, what is the best way to do this? And why doesn't Drupal core offer this by default? I thought that "changed by" is a pretty standard piece of information that a CMS should attach to content.


texts:
My question is simple: How do I get the product id's from a commerce order with Drupal code?
I have something like this at the moment:

  $orders = commerce_order_load_multiple(array(), array('status' => 'pending'), TRUE);
  foreach($orders as $order) {
    foreach ($order->commerce_line_items['und'] as $line) {
        $line_id = $line['line_item_id'];
        // ... product id, where are you?
    }

Hopefully somebody is able to answer this question :)


texts: Hide the actual location of a node on Views with GMap Module

texts:
What I'm trying to achieve is to hide the actual location of a node, either by replacing the marker with a circle, overlaying or inserting a radius(circle) around the actual location. Tried to do this with the help of macro builder but it doesn't accept replacement patterns in order to send the coordinates to the circle macro.

Any help is welcome, thanks in advance


texts: VBO showing error when using Drupal Commerce

texts:
I am getting the following error on a white page after using VBO and Drupal Commerce -

  *Call to a member function aggregate() on a non-object in
  .../sites/all/modules/contrib/views_bulk_operations/views_bulk_operations.module
  on line 764*

I upgraded to Drupal Commerce 7.x-1.x-dev and am running the latest version VBO and Commerce Stock

Whenever I try to perform any Bulk operation, like deleting a bunch of products or changing the order status, I get the error

I have looked at the issue, which discusses an issue with Commerce Stock and empty fields, but the solution found doesn't apply because all the stock levels have values.

Does anybody have any suggestions?

PS: I am not sure if this is a red herring, but I also am occasionally getting this message on the module admin page:

  *Notice: Undefined index: step in
  views_bulk_operations_form_validate() (line 621 of
  /var/www/html/nidadev/sites/all/modules/contrib/views_bulk_operations/views_bulk_operations.module).
  Notice: Undefined index: step in views_bulk_operations_form_submit()
  (line 664 of
  /var/www/html/nidadev/sites/all/modules/contrib/views_bulk_operations/views_bulk_operations.module).
  Notice: Undefined index: select_all_pages in
  views_bulk_operations_form_submit() (line 711 of
  /var/www/html/nidadev/sites/all/modules/contrib/views_bulk_operations/views_bulk_operations.module).
  Notice: Undefined index: operation in
  views_bulk_operations_form_submit() (line 713 of
  /var/www/html/nidadev/sites/all/modules/contrib/views_bulk_operations/views_bulk_operations.module).*


texts:
When you click 'Structure' in Drupal admin the page displayed is a print of the child items of the 'Structure' menu item.

I imagine this behaviour is relatively simple to achieve? I have a custom menu item using hook_menu but what do I need to do in page_callback in order to achieve the same results?


texts: How might a user configure which video is shown on page without editing the page?

texts:
A Drupal 7 site has an embedded YouTube video on the home page. It is not always displayed. Sometimes the video being displayed is changed. The home page is arranged by a Page Manager Variant, and the container with the video is "Custom Content". When someone wants to hide/show the video or change the link, they have to ask me because the Page Manager can only be accessed by an administrator. I want to give certain users the ability to show/hide the video and change the video to which it links, but without changing other content on the home page or modifying the layout of the site.

I don't really know what I'm doing when it comes to Drupal, and I'm having trouble figuring out the right things to search for to accomplish this.

I want the appropriate users to be able to choose which YouTube video is embedded and whether it is shown. What is the best way to do that?


texts: Where did date-time "add [custom] format" go in Drupal 7?

texts:
In D6 this was located in,
Site Configuration >> date & time >> formats >> add format
Where is this in D7?

I found this Drupal.SE question: Date value to different date format explaining the code to create a custom format, but it doesn't say in which file to make the change.


texts:
I am using the Feeds module to import data into my site from a CSV file.

When I try to import a row that has the € character, nothing gets imported and I get an error message.

  error:General error: 1366 Incorrect string value: '\xE0 Cali...' for
  column 'message' at row 1

How can I import special characters using Feeds?


texts: How to change the path when cloning the Taxonomy term view?

texts:
I am trying to clone the default Taxonomy Term view to a new view.

I have a Block with the list of contents when I was clicking one of the content inside the Block, it goes to this path: taxonomy/term/%.

But I want to change the path to blog/%

I have changed the Path in the view's settings to (blog/%) from (taxonomy/term/%),But when I will click the content in the block goes to the same Taxonomy/term/% not to new wanted path.

How to change the taxonomy/term/% path to blog/% ?


texts: Create Alias URL to taxonomy term page with TID

texts:
I am trying to figure out how to create a url-alias friendly url to a taxonomy term page with only the tid of the term. I know drupal does this automatically in the node, but I am trying to do this in a block.

e.g. Where the term is "Texas" with tid 34, and the alias is to the taxonomy page is "/location/texas"

So, instead of creating a url to this "/taxonomy/term/34", I would like to create a url to the aliased version of that link, to /location/texas, just with the TID.

Using Drupal 7.15

Thanks!


texts: Display images filed in views slideshow in node content page

texts:
Are there any ways to format/replace the images display in a node(e./g node/1)? I add a image field for my content type which allow multiple images, i want to display it in gallery/thumbnail/jcarousel/slideshow....

I know how to make a viewslideshow in a view, but it seems no way to do the same thing in node display (e./g node/1)


texts:
In my view I filtered for date "greater than now" and in the settings I put granularity "day".

I can see the 3 events correctly, but they are grouped by "month" and not in chronological order though.

Is there any option I can't find by myself to view the events in chronological order?

I sorted by date ASC

This is the export display:
https://kopy.io/DRwkf

This is the export of all the view:
https://kopy.io/KJsM0


texts:
Currently I am using states attribute in my form to show/hide a drodown having days as its value on selecting a parent dropdown value. My working scenerio is that I want to show a dropdown having 31 days if january,march,may.... is selected and to show another dropdown having 30 days as its value when febraury,april,june .... is selected , can some one suggest me how its could be achieved because in usage of #states attribute only one value could be selected.

function sandbox_ajax_dropdown($form, &$form_state) {

$options = array(1 => t('1 月'), 2 => t('2 月'), 3 => t('3 月'), 4 => t('4 月'), 5 => t('5 月'), 6 => t('6 月'), 7 => t('7 月'), 8 => t('8 月'), 9 => t('9 月'), 10 => t('10 月'), 11 => t('11 月'), 12 => t('12 月'),);

$form['state_list'] = array(
    '#type' => 'select',
    '#title' => 'Choose A Day First',
    '#options' => $options
);
$form['illinois_cities'] = array(
    '#type' => 'select',
    '#description' => t("Thirty-One Days."),
    '#states' => array(
        'visible' => array(
            ':input[name="state_list"]' => array('value' => '5'),
        ),
    ),
    '#options' => array(1 => t('1'), 2 => t('2'), 3 => t('3'), 4 => t('4'), 5 => t('5'), 6 => t('6'), 7 => t('7'), 8 => t('8'), 9 => t('9'), 10 => t('10'), 11 => t('11'), 12 => t('12'),
        13 => t('13'), 14 => t('14'), 15 => t('15'), 16 => t('16'), 17 => t('17'), 18 => t('18'), 19 => t('19'), 20 => t('20'), 21 => t('21'), 22 => t('22'), 23 => t('23'), 24 => t('24'),
        25 => t('25'), 26 => t('26'), 27 => t('27'), 28 => t('28'), 29 => t('29'), 30 => t('30'), 31 => t('31')),
);

$form['ohio_cities'] = array(
    '#type' => 'select',
    '#description' => t("Thirty Days."),
    '#states' => array(
        'visible' => array(
            ':input[name="state_list"]' => array('value' => '1', '2'),
        ),
    ),
    '#options' => array(1 => t('1'), 2 => t('2'), 3 => t('3'), 4 => t('4'), 5 => t('5'), 6 => t('6'), 7 => t('7'), 8 => t('8'), 9 => t('9'), 10 => t('10'), 11 => t('11'), 12 => t('12'),
        13 => t('13'), 14 => t('14'), 15 => t('15'), 16 => t('16'), 17 => t('17'), 18 => t('18'), 19 => t('19'), 20 => t('20'), 21 => t('21'), 22 => t('22'), 23 => t('23'), 24 => t('24'),
        25 => t('25'), 26 => t('26'), 27 => t('27'), 28 => t('28'), 29 => t('29'), 30 => t('30'))
);

return $form;

}


texts: Sorting prices from 3 product line item types using views

texts:
My goal is to display a message like "Prices start from 13.34$" for every taxonomy term that I created. I have 3 product types with 3 product line item types. What I did until now and I'm stuck is to create a view with the contextual filter "Content: Has taxonomy term ID", after I added the "Content: Taxonomy terms on node" relationship, without this, the contextual filter wasn't there (if I remember correctly) and I also added the "Content: Product Referance" relationship and here is my problem because when I add the referance from one of my product line item types everything is fine, I just added the price field and sort it by amount, but when I add the other 2 relationships for the products on the other line item types nothing is displayed, but if I uncheck the "require this relationship" for everything, the smallest prices from all 3 product line items is displayed.

Using this view I add it as a field to another view (using Views field module) and other fields that I require and everything works like a charm.

I was thinking to exclude them from display and using some sort of PHP sorting to display the smallest value from them, but I don't know how to do that.

Maybe there is another module or another much simpler solution to this, thanks for your time and suggestions.


texts: Split a date field output into two spans

texts:
I have a Date field on a content type. I'm trying to render it so that just the Month and Day are visible, but I need each in a separate .

I think the most appropriate place to do this is in the preprocess function for the node theme function. Within that function, here's the date field on the node object:

What is the appropriate way to convert this to something I can run a custom date formatter on, so I can get the month and the day separately?

This is my current approach:

$date_field = $node->field_event_date_time[$node->language][0];
$date_object = new DateObject($date_field['value'], new DateTimeZone($date_field['timezone_db']));

$variables['event_month'] = date_format_date($date_object, 'custom', 'M');
$variables['event_day'] = date_format_date($date_object, 'custom', 'j');

But it does seem a bit messy, and I've noticed is that the field won't always have the language array key, so that complicates it a bit further.


texts: How to add a placeholder to a form element using a twig template override

texts:
I enabled twig debug and realized I needed to add block--search.html.twig to my theme.
Then I used dump(content) to see if I could add a placeholder to search input field

{% extends "core/modules/block/templates/block.html.twig" %}
{% block content %}
  {{ dump(content) }}
  {{ content }}
{% endblock %}

How can I change the content array and add a new '#placeholder'=>'bla' to the search input?

dump(content) returns something like this:

array (size=23)
  '#action' => string '/search/node' (length=24)
  '#method' => string 'get' (length=3)
  'keys' =>
    array (size=26)
      '#type' => string 'search' (length=6)
      '#title' => string 'Search' (length=6)
      ...


texts: Add extra custom permissions to Field Permissions

texts:
I'm using Field Permissions module to restrict access to each field.
If you choose custom permission on /admin/structure/types/manage/CONTENT_TYPE/fields/FIELD_NAME, you'll see these permissions are available:

Enter own value for field [FIELD_NAME]
Edit own value for field [FIELD_NAME]
Edit any value for field [FIELD_NAME]
View own value for field [FIELD_NAME]
View any value for field [FIELD_NAME]

I would like to add some permissions with extra conditions like 'Edit any value for field [FIELD_NAME] if the field is empty'.
For D7 version of the module there was a hook called hook_field_permissions_list_alter but there's no such thing in D8 version.
Is there any way to modify the list?


texts: How can I allow HTML links in translated strings?

texts:
I created a custom D8 module with all text strings declared in English, either via this->t(), t() or in various configuration (YML) files.

I am now in the process of translating those strings in French so that I can then extract them and package them with the module.

My issue: some strings for the interface contain HTML links (mostly refering to other Drupal admin pages); they display and work fine in English, but when I try to translate those strings via the Drupal UI, I get an error saying "The submitted string contains disallowed HTML". If I remove the  then the error disappears.

Here's an example of a string containing several links:

$this->t('
Some explanations here. You can find a more information
  on the help page.
Note: after changing this value,
  you may have to clear the cache for this setting
  to take effect.
', array(
  '@hhelp' => '../../help/mymodule',
  '@hperformance' => '../development/performance',
)),

Is it possible to translate those strings while keeping the links in the translation? How should I proceed?


texts: Drupal for facebook, connect button disappearing. Please help?

texts:
My facebook connect button keeps disappearing.  Sometimes it's there, sometimes it's not and when it is it's only on the homepage.  My site address is www.idahorealestatereview.com.  Not sure how to fix this. I've read the README file, and followed the instructions. I am not sure what I'm missing.

The block is implemented by a module (Drupal for Facebook). I checked, and the block input format is full HTML.


texts: How to display Facebook friend count on your Drupal site

texts:
I was hoping for some insight as to how I should go about getting my Fan Page friend count to display on my Drupal driven site.

Are there any good tuts out there?

Any help would do

Thanks!


texts: Override default table template In custom module

texts: How can I use a custom module to override views-view-table.tpl.php? I understand how to do it for a theme, but I want to provide the template using a custom module. I've already created my replacement table theme file. I've put it in a folder called "templates" inside my custom module. Now I just need to understand what hook(s) I should use to tell views to check my module for replacement templates.


texts: Populate a text field with value from a date field on the same entity

texts:
I am using Drupal 7. I have 2 fields on a user entity, one is a date field from the date module (field_birthdaydate), and another is a textfield from the birthdays module (field_birthday).

I want users to enter their birthdays on the "field_birthdaydate" field, they will select the date and it appears like this: "16/03/2009"

I want this value to the be pre-populated on the "field_birthday" field as well (hidden from the users). I can achieve the field visibility part but I need help achieving the field pre-populate part.

My reason for doing this is because the birthdays module has some nice features and nice views filter support I can use in the future, but it is quite buggy at this stage to be used as a standalone birthday module, so I want to use it to store the birthday values for now, while using the date module to take the birthday input from users. When the birthdays module has finally fixed the pending issues, I will safely disable the date module and I wont be losing any birthday values.

I believe some custom code would help with this; when field field_birthdaydate is entered by user, populate field field_birthday with the same value before or during save. This is some pseudocode for what I want to achieve:

$user_input = "what the user will input";

if (field_birthdaydate == $user_input) {

set (field_birthday == field_birthdaydate);
}


texts: Is there a way to alter a form, implemented by another module, using a class?

texts: Is there a way to alter a form, implemented by another module, using a class, in the same way it is possible to build a form using a class?


texts: Multiple aliased pages for same taxonomy term (e.g. blog/term1 and images/term1)

texts:
I have some taxonomy vocabularies that are used on different content types (blog posts, images, businesses etc.).

I want to create a main page for each content type listing, and filter those listings by taxonomy terms, creating multiple aliased pages.

For example:

BLOG:

main blog page listing all blog posts and some related blocks @ /blog
blog sub-pages for each vocabulary/term listing blog posts with that term @ /blog/vocabulary/term

ACTIVITIES:

main page listing all businesses @ /activities
activities sub-pages for each vocabulary/term applied to the businesses @activies/vocabulary/term

The problem I am having is to have aliases and metatags set automatically using the taxonomy data.

I would like "content-type/vocabulary/term" (not "vocabulary/term/content-type"), and to still be able to use "vocabulary/term" (default Views or Panels taxonomy term templates) as general pages listing all content types.

Is this possibile?


texts: HTML after label radio button (depending on radio button)

texts:
I need to add some html to specific radio buttons. This is a picture to clarify what I'm looking for:

As you can see I want to add some text to the options. These are radio buttons where you can select one option. This is what I have now:

I've tried adding html with the theme_radio function with suffix like this:

function ppprogram_radio($variables) {
    $element = $variables['element'];
    $element['#attributes']['type'] = 'radio';
    $element['#suffx'] = "
just testing
";

    element_set_attributes($element, array('id', 'name','#return_value' => 'value'));

    if (isset($element['#return_value']) && $element['#value'] !== FALSE && $element['#value'] == $element['#return_value']) {
        $element['#attributes']['checked'] = 'checked';
    }
    _form_set_class($element, array('form-radio'));

    return '<input' . drupal_attributes($element['#attributes']) . ' />';
}

But that didn't do anything ... . I've also tried adding html to the return but then it's added before my label and I want it after my label.


texts: Securing folder in Custom Module for Drupal 6

texts:
I wrote a custom module, which logs errors to an external text file.  The files are kept in

/sites/all/modules/custom/my_module/logging/

The problem is, if the user know the name of the file, they can go directly to it.  For example, if they go to:

http://localhost/MySite/web/sites/all/modules/custom/my_module/logging/

The will get a forbidden error.  But, if they know the name of the document and go to:

http://localhost/MySite/web/sites/all/modules/custom/my_module/logging/myFile.txt

the full file is rendered to the browser.  Is there a way to prevent this?  Ideally, I would like to show the files to certain users but at the very least prevent it all together.


texts:
I have a problem with Nodejs and Rules action with node.js modules

First, I have installed node.js on my server following the README.txt instructions and then configured the node.config.js file as the sample file and had no problem connecting Drupal with node.js. But after creating a rule of new nodes, I checked messages like this in the debugger:

Started http server.
   info  - socket.io started
publishMessageToContentChannel: message { uniqid: '520d016b52adc',
  markup: '
\n

\n

\n
\n      TEST TITLE
\n
value of body action message
\n
\n',
  callback: 'nodejsAction',
  messageAuthorUid: '1',
  channel: 'rules_nodejs_role_2',
  clientSocketId: '' }
publishMessageToContentChannel: message { uniqid: '520d016b52adc',
  markup: '
\n

\n

\n
\n      TEST TITLE
\n
value of body action message
\n
\n',
  callback: 'nodejsAction',
  messageAuthorUid: '1',
  channel: 'rules_nodejs_user_3',
  clientSocketId: '' }
publishMessageToContentChannel: The channel "rules_nodejs_user_3" doesn't exist.
publishMessageToContentChannel: message { channel: 'watchdog_dblog',
  commands:
   [ { command: 'insert',
       method: 'before',
       selector: '#admin-dblog tr:eq(1)',
       data: '
	content	08/15/2013 - 12:27
          page: added node 18.	admin	view
',
       settings: null } ],
  callback: 'nodejsWatchdog',
  clientSocketId: '' }
publishMessageToContentChannel: The channel "watchdog_dblog" doesn't exist.
setContentToken: message { token: 'Xx0RmC36fXFTnyH_goIX21fP-2iDJMhTk_u-iWBpcM4',
  channel: 'rules_nodejs_user_1',
  notifyOnDisconnect: false }
setContentToken Xx0RmC36fXFTnyH_goIX21fP-2iDJMhTk_u-iWBpcM4 for channel rules_nodejs_user_1
setContentToken: message { token: 'u3EbOVHjEdIiL6mlGbN8p4T5CifL2Gt-tZc2jfqfbCE',
  channel: 'rules_nodejs_role_2',
  notifyOnDisconnect: false }
setContentToken u3EbOVHjEdIiL6mlGbN8p4T5CifL2Gt-tZc2jfqfbCE for channel rules_nodejs_role_2
setContentToken: message { token: '9WLPPJWOr7XlMXLYbhhiuBvMwN4Bd4o9_6exS-_cspU',
  channel: 'rules_nodejs_role_3',
  notifyOnDisconnect: false }
setContentToken 9WLPPJWOr7XlMXLYbhhiuBvMwN4Bd4o9_6exS-_cspU for channel rules_nodejs_role_3

However, I couldn't get the notifications on my browser and I don't know if I'm missing some extra configuration for it.


texts:
I need to display nodes in a dynamic view, based on their vocabulary and not a single term. For example, for car sales, one vocabulary lets the visitor select one model, and another selects the color.

My custom path looks like this:

/sales/cars/%            // vocabulary view
/sales/cars/%            // vocabulary view

/sales/cars/models/%     // taxonomy term view   (works !)
/sales/cars/colors/%     // taxonomy term view   (works !)

URL example:

/sales/cars/models       // all nodes with a term from models vocabulary
/sales/cars/colors       // all nodes with a term from colors vocabulary

I've tried a solution from a similar question, but I can not find a Contextual Filter called:

  Taxonomy vocabulary: Machine name


texts:
I am using below code to delete all unregistered users node.
But it takes very long time to execute node_delete function.I have around 5000 records of users in node table.
How can I improve the performance of node_delete() function?

$query_node = db_query("SELECT n.nid FROM node n,status s WHERE s.entity_id = n.nid  AND type = 'employees' AND s.field_employee_status_value = '2' AND n.status = '1'");
$result_node = $query_node->fetchAll();

foreach($result_node as $node)
{
    $nid = $node->nid;
    // $node id , which you want to delete;
    node_delete($nid);
}


texts: How can I detect when a node is changed from 'Published' to 'Unpublished'?

texts:
In hook_node_update(), I can easily tell the 'status' of a node (whether it's published or not) after it's been updated.

However, is there an easy way to check to see if the updated node was published, but now is not? (Or vice-versa)?

I think Rules might have some condition for 'node value has changed' or something along those lines, but I'd like to do this programmatically.

I found this issue by fago (developer of Rules) on drupal.org that seems to deal with this in Drupal 7, but a nice explanation would be appreciated.


texts: What Commcerce event is fired when a payment is made?

texts:
There seem to be a few bugs in Commerce (8.x-2.17) related to admins making payments against a Cart. I am trying to fix some of these in my own custom module (rather than wait for people to agree these are bugs). Some, but not all, include:

payments made are not reflected anywhere.
when paid in full the order is not "completed" (not sure if this is correct term, in D7 i think the term was "checked out").
payments can be made beyond the full amount of the order (or the balance)

I think it should be possible to address some of these by subscribing to a Payment event and going in and cleaning things up (not sure where or how to clean up; but baby steps).

I have seen a post listing: commerce_order.order.paid as an event that is fired when the order is paid in full; but this is not fired (as far as i can tell) when a payment is made which completes the order (neither from admin paying or standard checkout flow).

I have also seen commerce_payment.commerce_payment.insert,  which is also not fired during payment or checkout flow. To be honest i don't understand the naming related to payments: add payment, insert, update? Why is this not "make" a payment as this is more grammatically correct.

Does anyone know what event is triggered when a payment is made (or ideally when a payment covers the balance owing on an order)?


texts: Can't save location when posting node through services module

texts:
I am using services module to post nodes using rest/json. The nodes also contain images and location. So far I can upload the image and save the node, but the location is not saved. I receive no errors in logs.

Any ideas? Is there something I have to add,maybe permissions, in order to be saved?

This is the json that creates the article but doens not save the location.

{
    "title": "some title",
    "type": "article",
    "language": "el",
    "body" : {
          "und": [
              {
                  "value": "some text"
              } ]
    },
    "field_tags": { "und": "9" },
    "field_image": {
        "und":
          [{
            "fid": "1364"
          }]

    },
    "locations":{
        "und":[
                {
                  "country":"gr",
                  "latitude":"55.7046601",
                  "longitude":"13.191007300000024",
                  "name":"TEST LOCATION",
                }
            ]
    }

}


texts: "Did you mean this ?" Google site search and views exposed filter integration

texts: Is there a way to use Google site search to search through Views Exposed Filters. Basically for autosuggestion and "did you mean this".


texts: Why did ~20k Drupal 7 websites just drop off the map?

texts:
I was looking at Drupal statistics and surprised by how a bunch of sites just disappeared from the count. I'm assuming this is due to a change in the code, and not actually reflective of total count. But who knows!? Can anyone here offer any deeper insight?

https://drupal.org/project/usage/drupal

https://drupal.org/project/usage/1960640


texts: Why does this simple javascript execute multiple times?

texts:
Why does this javascript execute 2-4 times per page load:

// mei_library_turn.js
(function ($, Drupal) {
  Drupal.behaviors.mei_library_turn = {
    attach: function() {

      console.log('ready1');

      // There would be a lot more code in here, but I've stripped it all out to debug.

    }
  };

})(jQuery, Drupal, drupalSettings);

That is the entirety of the javascript file.  What could possibly be causing this to fire multiple times?  The script is not included in the head of the document multiple times.

Most often, when I load the page, it fires 3-4 times.  Sometimes just two times.

I realize once() can be used to mask problems like these, but it adds complexity to scripts and I would like to understand what is causing the code to execute multiple times in the first place.

Here is the page where I attach the library:

public function book($marc_num) {

    $output = [];

    $output['something']['#attached']['library'][] = 'mei_library/librarybook';

    return $output;

  }

Here is my libraries file:

librarybook:
  version: 1.x
  js:
    js/mei_library_turn.js: {}


texts:
I'm working on a Drupal 8 project where I need to show closed webforms as read-only form (without submit button and possibility to answer them), but Webform behaviour doesn't fit my need, as it only display a message "Sorry...This form is closed to new submissions." without displaying the webform.

Is their any way/hook that will allow me to display these closed webform?


texts:
I have a custom content type called "questions" and few others , "A", "B","C" . (the naming is irrelevant, actually).
Each one of the following content types "A","B","C" has a field that is referencing to a particular node with content type "question".

What I would like to do is to display in a View all questions and next to each question, the titles of referencing nodes(with links to the node).

What approach should be taken ?


texts:
I am using Webform with AJAX module. I have added the Webform in block and submit it via AJAX. All I want to do is open new form after getting confirmation message without reloading whole page and without clicking "Go back to form".

How to do Go back to form automatic after 5 sec for example?


texts: Content-type linked to specific users and user-groups

texts:
I am creating a system which has 2 types of user: a Member and a Group Admin. Members are put into Groups and are managed by that groups Admin. A Member can contact their Group Admin but not other Group Admins. Some of this contact data/messages should be visible to other Members of that particular Group, some information should be visible only to that Member and the Group Admin. In certain situations, a Group Admin should be able to become the Group Admin of another Group. Members can make complaints to Group Admins who are able to respond. Anonymous users should be able to make complaints, provided they provide extra information, e.g., name, address, telephone number. Ideally, when making a complaint they would be asked if they would like to create an account.

Being new to Drupal (started looking through the Docs a week ago) I'm having trouble with pretty much everything. Using Drupal has been made a requirement as it is meant to make the process easier; however, for me it is not. As there are approximately 800 different groups does this mean that I'm going to have a huge matrix of permissions? Am I going to have to create 800 different roles? I'm struggling visualising the architecture of the system and the modules I'll need. For example, I'd created a content-type Complaint; however, everyone could see it. Drupal 7 Core has no way to restrict different users from viewing specific content. I remedied this by installing a module: Content Access. Any suggestions for the architecture and modules would be useful.


texts:
In my recent Drupal 8 project, we have the master-slave setup and we face binary-log files getting generated to a huge amount for every hour. On decoding these binary log files we figured out a lot of INSERT INTO statements to 'cache_render', 'cache_menu', 'cache_data' tables. But we have enabled Memcache setup at the server level and its working fine and also disabled all default Drupal caches from admin backend.
Even after these, does the Drupal 8 by default make entries to cache related tables? Do someone faced the same before?


texts: Drupal allows menu tabs on Views pages. Why, and why not on other kinds of content?

texts:
In my question Most maintainable way to make page with one top half and alternative bottom halves selected by tabs?, I've asked about making a page with, as the title says, alternative bottom parts selected by tabs. There are various modules (Quick Tabs, Panels Tabs, etc.) that do tabs. But I have found that core Drupal itself has a feature for adding tabbed menus to Views pages. It's explained for example at Randy "Wilson" Brown's Drupal: How To Add A Tab To A Views Page. Why only to a Views page?

And — suppose I try to use these menus to select between things that really aren't views. For example, suppose I try to set up a page that has three tabs called "Photo 1", "Photo 2", and "Photo 3", each of which selects a different photo of my cat. I don't know whether I can make the views menus do this, but should I even try? Or is it likely to lead to problems, for example by being hard to do and maintain?

(Added a few days after posting) I'm adding the paragraphs below to clarify the spirit of what I'm asking.

I've coded with many languages and libraries where, to get a job done, you must "pervert" them because they lack the features needed to do the job cleanly. One example is passing primitive types by reference in Java. Suppose you want to write a method that takes an 'int' parameter and gives it a new value. You can't do that cleanly, because Java lacks call-by-reference for primitive types. But you can fudge it by giving your method an integer array parameter and passing your 'int' in an array. It works because arrays are compound entities, and Java passes those by reference. But it's bad, because arrays are intended for storing sequences, and you're misusing them for something else. It makes the code harder to read.

How does this relate to Drupal? I've come across several articles, in blogs and elsewhere, which appear to be doing the same kind of thing with views. For example, there's a post by Ron Golan at https: //www.urbaninsight.com/2013/11/01/views-menu-tabs-quick-guide which uses views to tab between different tabbed pages about a coffee grinder. One of these tabbed pages is a photo of the coffee grinder. In my mind, that's not a "natural" thing to use views for, because they are, in essence, database queries. And you don't need database queries in order to place one photo whose identity you know in advance.

Therefore, I suspect Golan is using views because he wanted their tabbed menus. When I see something like that, I have to think like an engineer and ask: somebody clever thought this trick worth using. Why? Why didn't he use a more direct technique? Is it because the trick, though perverse, is less risky than other techniques? For example, because it will not collapse if I update my Drupal or my jQuery. If I didn't ask such questions, I'd be betraying my client, because I'm ignoring information that might indicate dangers in some of my tools.


texts: Specifying text format when creating field on custom node type

texts:
I have a module that's creating a custom node type. I'm attaching a textarea to this node type. Currently it works, but the text formatting defaults to "Plain Text."

I would like to specify during installation that the field should be set to "Filtered Text," specifically, "Filtered HTML." This seems like something that should be possible when defining the instance of the field, but it's not working.

Here's the instance definition as it stands now:

<?php
// ...more fields above
    'release_notes' => array(
      'field_name' => 'release_notes',
      'type' => 'text_long',
      'label'  => $t('Notes'),
      'description'  => $t('Release notes (e.g. liner notes)'),
      'widget' => array('type' => 'text_textarea'),
      'settings' => array('text_processing ' => '1'), // Filtered HTML...?
      'weight' => 9,
    ),
// ...more fields below
?>

Does anyone have any ideas?

Thanks.


texts: Features - Custom User Fields Not Available after Import

texts:
I have two Drupal sites.

On Site1, I created 4 custom text fields for the User Profile. I created a Feature that included these fields. I didn't see an area where I could export the settings for Custom User fields, so I searched for their respective machine names and added them.

On site #2, I added the feature and the fields now appear to be imported.

Despite this, when going to Configuration > People > Account settings, going to "Add existing field" does not list the newly imported fields to that list. They also are not available as "Existing Fields" when modifying a Content Type.

On top of that, when attempting to create a field with the same machine name, it states that it is already taken.

It seems the Features has indeed imported the desired fields but they are for some reason inaccessible.

How can this be fixed?


texts:
is it possible to get the amount of "new flags" in views? Like the "new comments" field. For example a user's article was flagged 2 times. After his login he should see in a view: "2 new flaggs on your article".

Drupal 7;
Views 3; Flag 7.x-3.2

thanks for ur help!
lolhonk


texts:
I have built a website using drupal. Now, the base URL is http://xxx.xxx.xxx.xxx/drupal.
But I want to change base URL as http://xxx.xxx.xxx.xxx
How do I do?

Thanks.


texts: I searched a lot on net, but did not find proper answer for the customizing / theming  a view that is created. I have created a view like one in screenshot . I wanted to change the way the pagination appears and some cosmetic changes for it. So whats the best way to do it.


texts: Views fields settings style settings no options avaible

texts:
In views, after I choose 'Fields' as format, I want to add HTML to the title field.
The way you would normally do this is is expand the "Style settings" fieldset, then check "Customize field HTML". Only on the Drupal site in question there is nothing that expands under the checked item. I checked permissions and flushed caches but other than that I don't know how I woul be able to look at this. Could this be a javascript issue? Also checked console for that, but no errors there.


texts: How to create a group page when creating a new group?

texts:
When I create a new group (using the Organic groups module), I want to use the Rules module to create a new group referenced page.

I can create a new page using the Create new entity action, but I haven't been able to set the group reference/audience. I've tried using both Add entity to Group and Set a data value, but I can't figure out how to set the parameters.

{ "rules_create_1st_story_page" : {
"LABEL" : "Create 1st Story Page",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "og" ],
"ON" : { "node_insert--story" : { "bundle" : "story" } },
"DO" : [
  { "entity_create" : {
      "USING" : {
        "type" : "node",
        "param_type" : "story_page",
        "param_title" : "Page 1 - Start here",
        "param_author" : [ "site:current-user" ]
      },
      "PROVIDE" : { "entity_created" : { "entity_created" : "Created entity" } }
    }
  },
  { "og_group_content_add" : { "entity" : [ "node" ], "group" : [ "node" ] } }
] }}


texts: How to get all nodes referencing a particular node?

texts:
I have two node types, which I'll call A and B. Type A is a fairly straightforward content type, the only thing special is that it has a field (field_appearances) that references B nodes (tag-style, so each A may have one or more B tagged).
I am using Views to create a nice listing of all my B nodes, and I would like to have each B in this view list the A nodes that are referencing it (basically, so that users can easily see a list of A's that reference that particular B).
Effectively, this should look something like this:

B.1

Used in: A.1, A.2, A.3

B.2

Used in: A.2, A.4

What I've tried
First, I tried setting a relationship Content using field_appearances, then added a Title field to the view that used that relationship. This created a row for each B+A like so:

B.1

Used in: A.1

B.1

Used in: A.2

B.1

Used in: A.3

(...and so on for each B)

Next, I enabled aggregation and tried using various setups to get this right. The closest I got was setting the (referenced) Title field to aggregate on COUNT, which got me the following:

B.1

Used in: 3

B.2

Used in: 2

Any suggestions? I tried dinking around with Contextual filters but didn't get anything close to being right.


texts: Trusted_host_patterns not working with domain

texts:
I'm working with a drupal 8 site and trying to get trusted_host_patterns working properly with the domain that I'm using, and no matter what combination of regex I try I can only get it to work with the catch-all '^.*$'. So far, I've used (plus a couple more):

'^production\.sitename\.com$',
'^www\.production\.sitename\.com$',
'^.+.production.sitename.com.$',   // which I know is the same but more general than above

which as far as I know from looking at examples, should work. Is there anything I'm missing?


texts:
I've been at this for a few hours now but can't find a good way to solve this.

Basically what i want to achieve is to trough my template.php file completely override the comment modules output of links when displayed on a node teaser.

So i want to remove the "Add New Comment", "2 New Comments", "2 Comments" for example and have it replaced by only one single button saying something like "Comments (2)" instead.


texts: HTML stored in text field and not rendered in view

texts:
I'm trying to render HTML that's stored in a text field in a view. The output looks like this

My text

If I inspect it, it's wrapped in quotes so it's treated as a string. How do I parse this on the front end?


texts:
I'm building a module to extend the functionality of Nodequeue.
So in the nodequeue list I wanna add one more operation link (to the current View | Edit | Delete operations).

The list is build up in a table using theme('table') by Nodequeue.

So for me the be able to extend the content of this table and add one more link, I'm thinking I'll have to preprocess the table theme?
So I'll make a MYMODULE_preprocess_table(&$variables)?

But I just feels like its totally overkill? It must be more simple than that?
Like in the Form API hooks, I have hook_form_FORM_ID_alter().

Is there any alternative to hook_preprocess_hook?


texts: Allow multiple taxonomy term values on term listing page

texts:
Is it possible to return results of multiple taxonomy terms on the taxonomy/term/%tid page?

For example, taxonomy/term/203+221 or taxonomy/term/203/221 should display all nodes with either one of those two terms.


texts: I have multiple views with pagers on same page. But all of the pagers using the same GET argument "page", so when user chooses a page in first pager, all of the pagers changing their state to those page. How can I make things work? Drupal 6, Views 2.


texts: Can no longer access administration pages - Warning/Error

texts:
Today, I logged in as administrator to my Drupal 7 site. I was using overlay, viewing "People", and everything was working fine. Then I clicked on "Reports".

All of a sudden, I had a white screen, and can no longer access any of the administration pages of my site. When clicking back to the home screen, I get multiple instances of this error:

Warning: require_once(C:\inetp): failed to open stream: No such file or directory in module_load_include() (line 330 of C:\inetpub\wwwroot\includes\module.inc).

I was using the administration pages just fine a couple days ago. I'm not sure what could of happened. The only thing recent was I updated Views - but this was quite a little while back - and again, had no problems after that up until now.

Can someone help?
Thanks!


texts: How to make slideshows work on mobile devices browsers?

texts:
I created a view formatted slideshow using Views Slideshow
and another formatted flexslider using Flex Slider.

But the two blocks show no content when displaying the page from a mobile device.

What's wrong (with flexslider as it support mobile) or how to make the slideshow work for mobile using one of the two modules listed?


texts: Is there a way to override paths defined in *.libraries.yml

texts:
Guess I found a bug here and already filed it:

Created custom profile,
added https://www.drupal.org/project/mmenu dependency (which then is placed under profiles/profile_name/modules/contrib/mmenu).
Added MMenu libraries (jquery.mmenu, hammer.js, jquery.hammer),
activated everything but then Drupal looks for the wrong library paths under libraries/mmenu instead of profiles/profile_name/libraries/mmenu.

libraries_get_path('mmenu') returns correct path (profiles/profile_name/libraries/mmenu).

drupal_get_profile() returns correct profile.

Drupal seems to only take the paths defined in mmenu.libraries.yml into account. Changing them makes everything work as desired. So, I'm asking myself now: Is there any possibility to override the paths defined in mmenu.libraries.yml from a custom module?


texts: How to compare two fields in a preprocess_field()

texts:
I need to compare two fields using template_preprocess_field().

I've got a field date and a boolean field.
Field date collect start and end date but if it's one day event, I need to show "start date - one day"

If you don't collect the end date, it will be the same date of the start date.
Of course I can compare start date and end date and if they are the same I will show "one day" but if the event is still running (so I won't collect the end date), I should show "on air"

So I'm trying this

function bartik_preprocess_field(&$variables) {

  //here I call the date field
  if($variables['element']['#field_name'] == 'field_duration') {
    $starttotime = time($variables['element']['#items'][0]['value']); // convert it in time
    $starttodate = date('d-m-y', $starttotime); // formatting date

    // check if start date and end date are similar
    if ($variables['element']['#items'][0]['value'] == $variables['element']['#items'][0]['value2']) {
      // HERE I NEED TO CHECK THE OTHER FIELD
      if (HERE THE FIELD ONE DAY == 0) {
        $variables['items'][0]['#markup'] = $starttodate." - One day";
      } else {
        $variables['items'][0]['#markup'] = $starttodate." - On air";}
      }
    }
  }


texts: How to get all parent menu items' titles of the current node?

texts:
I know I can load the node's menu item like so:

$node_id = $node->id();
$menu_link_manager = \Drupal::service('plugin.manager.menu.link');
$result = $menu_link_manager->loadLinksByRoute('entity.node.canonical', array('node' => $node_id));

But to use a menu structure in a breadcrumb I need to load all parent menu items. I feel like the menu service provides such a function but I dont get anything out of the documentation. This here seems pretty mighty but it really lacks documentation.

Edit: I've already came this far:

$node_id = $node->id();
$menu_link_manager = \Drupal::service('plugin.manager.menu.link');
$menu_link = $menu_link_manager->loadLinksByRoute('entity.node.canonical', array('node' => $node_id));

if (is_array($menu_link) && count($menu_link)) {
  $menu_link = reset($menu_link);
  if ($menu_link->getParent()) {
    $parents = $menu_link_manager->getParentIds($menu_link->getParent());
    dpm($parents);
  }
}

and it gives me:

Array
(
  [menu_link_content:2fd24ddd-19e2-4e8f-9764-839b3f51139e] => menu_link_content:2fd24ddd-19e2-4e8f-9764-839b3f51139e
  [menu_link_content:e30b827f-bc67-4892-b23f-28b23188ffd4] => menu_link_content:e30b827f-bc67-4892-b23f-28b23188ffd4
)

Is there an easy way to get those titles?


texts: hook_mail_alter() - how to access the "contact admin" form fields?

texts:
In Drupal 7.10 I have the /contact form open to anyone and would liketo add the Reply-To header to the mail message.

How do I get the value of the e-mail address field in the /contact form - both for guests and registered users?

Here is what I'm trying:

function your_module_mail_alter(&$message) {
  if ( $message['id'] == 'contact_page_mail' ) {
     $message['headers']['Reply-to'] = YYY;
  }
}


texts: Validate upload size before starting upload with Filefield?

texts:
I'm doing some pretty massive uploads, up to 1gig. Right now if I upload a 1.1 gig file it uploads to the limit then fails.

Is there any way to make it fail before even beginning the upload?


texts: Create an EventSubscriber for a specific module

texts:
I'm attempting to make something occur at a specific event in the GatherContent module found here https://www.drupal.org/project/gathercontent

Based on the information here http://help.gathercontent.com/importing-and-exporting-content/drupal-integration/drupal-integration-extending-the-module-using-the-api and several tutorials and documentation

I created a module with the code entered like so

my_gathercontent.services.yml

services:
  my_gathercontent:
    class: '\Drupal\my_gathercontent\EventSubscriber\MyGatherContentSubscriber'
    tags:
      - { name: 'event_subscriber' }

src/EventSubscriber/MyGatherContentSubscriber.php

namespace Drupal\my_gathercontent\EventSubscriber;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;

/**
 * Event Subscriber MyGatherContentSubscriber.
 */

class MyGatherContentSubscriber implements EventSubscriberInterface {
    public function onGatherContentPostImport(DrupalgathercontentEventPostImportEvent $event) {
        \Drupal::logger('my_gathercontent')->notice('This is a test');
        drupal_set_message("Debug: This is a test.");
        var_dump($event);
    }
    public static function getSubscribedEvents() {
        $events['gathercontent.post_import'] = ['onGatherContentPostImport'];
        return $events;
    }
}

And none of those messages get logged. I do now receive a page not found message after performing an action that should trigger that event. I'm not sure what I'm doing wrong.

Is there something wrong with the way I'm attempting to subscribe to the event?


texts: How can I show a parent page's field on all subpages?

texts:
I'm trying to get a Basic Page's Banner Image field to display on its Basic Page AND any of that page's children. Those children may or may not be the same content type.

Ideal outcome:

The content editor creates a new Basic Page called About Us
They upload an image for the Basic Page's Banner Image field
They create a new page of any content type, let's say a Contact webform
Contact's menu settings make it a child of About Us
Contact and About Us both automatically show the Banner Image that was set in About Us

I've tried solving this with php in my page template and with views & blocks, but I'm not getting very far. Any ideas?


texts: how generate chart from Views Aggretation Plus

texts:
I created a table from webform submission data (group and compress) using Views Aggregator Plus

I would like to generate a pie chart from this table (industry as the label and turnover as the values).

Any hints to generate the pie chart would be appreciated.


texts: Pop-Up E-mail subscription ( module) or appearing form?

texts:
Is it possible with a certain module or anything of that nature to have a pop with a subscription email-collector inside?

I'm on the final touch-ups of the site and have basically got this left and a few other things. But there is not really too much on this site that I can find that answers this question directly for a newbie.


texts: I have a front page that consists mostly of context rules to load various blocks, and for some users, a requirement to render a Ctools modal with a call to action. We aren't displaying much on the homepage besides a few views, and static blocks. I'm using this guide to build out the actual modal (which itself, will display a view with Contextual rules based on the user's settings) to show content tailored to them. Is there any in-code hooks I can use to activate this modal only on the home page, or should I look into the option of using a custom developed block (using hook_block_info() and hook_block_view()) to activate the modal on that page?


texts: Radio buttons triggering an AJAX callback to load form elements are pre-selected after navigating back to form in browser

texts:
My form looks like this:

  $form['field_1'] = array(
    '#title' => t('Field 1'),
    '#type' => 'radios',
    '#required' => TRUE,
    '#multiple' => FALSE,
    '#ajax' => array(
      'callback' => '_myform_ajax_field_2',
      'wrapper' => 'field-2-wrapper',
      'method' => 'replace',
      'effect' => 'fade',
    ),
  );

  $form['field_2_wrapper'] = array(
    '#prefix' => '
',
    '#suffix' => '
',
    '#weight' => 2,
  );

  if (isset($form_state['values']['field_1']) && $form_state['values']['field_1'] > 0) {
    $form['field_2_wrapper']['field_2'] = array(
      '#title' => t('Field 2'),
      '#type' => 'radios',
      '#required' => TRUE,
      '#multiple' => FALSE,
    );
  }

The problem occurs when I submit the form successfully and move to the next page, and then navigate back to this form using browser back button and the field_1 radio button is remembered by the browser. This means that the radio is already selected however in this instance form_state['values'] is empty so field_2 does not display. From here the only way to get field_2 to load via AJAX is to un/re-select the desired option in field_1.

I've tried the following solutions which failed:

Adding a JS file to $form[#attached]['js'] to deselect any radio buttons on load, however this also gets loaded in AJAX calls. I'm not aware of a method to prevent this JS from running as a result of a traditional page load, but not on AJAX.
I've tried setting a #default_value on field_1 however this has no effect.

Since writing this question, I've discovered a solution which I'm really not happy with:

I am checking for and adding a unique class name to the page body to check whether I've already deselected radios. If it's already there, then don't try again. This works, it just feels a bit dirty, so I'm hoping there's a more Drupally way to solve this?


texts: Drupal 7 module issues using node_ functions

texts:
I'm building a basic D7 module that fetches data from an API and then add it as a certain content type. Problem is, every node_ function is coming back as undefined. node_object_prepare, node_submit, and node_save with this error message:

Call to undefined function node_object_prepare()

The module is bare bones...
info file:

name = Social Fetch
description = Fetches feeds from various social media platforms.
package = public-action
version = 1.0
core = 7.x
files[] = social_fetch.module

and the social_fetch.module...

<?php
if(isset($_GET['fetch']))
{
    social_fetch();
}

function social_fetch(){
        $node = new stdClass();
        $node->title = 'test';
        $node->type = "social_boxes";
        node_object_prepare($node); // Sets some defaults. Invokes hook_prepare() and hook_node_prepare().
        $node->language = LANGUAGE_NONE; // Or e.g. 'en' if locale is enabled
        $node->uid = 1;
        $node->status = 0; //(1 or 0): published or not
        $node->promote = 0; //(1 or 0): promoted to front page
        $node->comment = 0; // 0 = comments disabled, 1 = read only, 2 = read/write
        $node = node_submit($node); // Prepare node for saving
        node_save($node);
}

So much as I knew, node_ was part of the core and wouldn't need any dependencies but I may be wrong. I tried adding this:

module_load_include('inc', 'node', 'node.module');

but that did nothing.
also tried loading the bootstrap to see if maybe this was being run before the core loaded, but that did nothing as well.

  require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
  drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

Am I missing something? should this be run in a hook of some kind and if so, which?

Side Note

I am able to achieve what I need by using the db_ methods below. It just seems like an inferior way to do so since I don't actually know the anatomy of a node to know if these are the only things required to make sure the system remains stable. The kind of things the node API would have handled 100%.

      $nid = db_insert('node')
        ->fields(array(
          'title' => 'test',
          'uid' => 1,
          'type' => 'social_boxes',
          'language' => 'und',
          'status' => 0,
          'comment' => 0,
          'promote' => 0,
          'created' => REQUEST_TIME,
          'changed' => REQUEST_TIME,
        ))
        ->execute();

        if($nid)
        {
            db_update('node') //add vid back into the new node
              ->fields(array(
                'vid' => $nid
              ))
              ->condition('nid', $nid, '=')
              ->execute();

            db_insert('node_revision')
            ->fields(array(
              'nid' => $nid,
              'vid' => $nid,
              'uid' => 1,
              'title' => $class->getText(),
              'timestamp' => REQUEST_TIME,
              'log' => '',
              'status' => 0,
              'comment' => 0,
              'promote' => 0,
              'sticky' => 0
            ))
            ->execute();
        }


texts: What's the correct format for submitting a null value to an integer field using metadata wrapper?

texts:
Problem

Whenever I submit a nothing to an integer field using the EntityMetadataWrapper I get the following error.

What's the correct format for submitting a null value to an integer field? (I don't want 0, but a blank value).

  EntityMetadataWrapperException: Invalid data value given. Be sure it matches the required data type and format. in
  EntityMetadataWrapper->set() (line 122 of
  C:\XAMPP\htdocs\drupal\sites\all\modules\entity\includes\entity.wrapper.inc).

How do you clear a field value with entity_metadata_wrapper()?

The post above implies I should be able to use:

$wrapper->title = '';

However this still throws the error.

Example

I have an integer field Salary added to a custom node type. (Along with several other fields which work as expected.)

Properties:

Not required
Has no minimum value
No default value
Can only hold one value.

I have a custom form which looks like this. This is the entry field:

$form['field_salary'] = array(
    '#type' => 'textfield',
    '#title' => t('Salary'),
    '#size' => 10,
    '#maxlength' => 10,
    '#description' => t('Please enter a valid number'),

This is the submit function taken from here:

function postajob_form_submit($form, &$form_state) {

 $values = array(
      'type' => 'job_advert',
      'uid' => $user->uid,
      'status' => 1,
      'comment' => 1,
      'promote' => 0,
    );
    $entity = entity_create('node', $values);

    $ewrapper = entity_metadata_wrapper('node', $entity);

    //.... (other fields in the form are here)
    $ewrapper->field_salary->set($form_state['values']['field_salary']);

    $ref_nid = 15;

    $my_date = new DateTime('January 1, 2013');
    $entity->field_my_date[LANGUAGE_NONE][0] = array(
       'value' => date_format($my_date, 'Y-m-d'),
       'timezone' => 'UTC',
       'timezone_db' => 'UTC',
     );

    $ewrapper->save(true);
    entity_save('node', $entity);

}

My guess is that it can't hold nothing? But that seems weird because it's not required.

I can for example create the node using the drupal default form with no errors and it works fine.

EDIT:

The solution from Wayne, removes the error but what I was hoping for was the ability to submit a blank value without it throwing an error. Unfortunately the following doesn't work.

'#default_value' => NULL,

I've considered using a string field instead of an integer one and then validating only for numbers, but this means I'll lose the ability to use the numeric range search facets, again not ideal.


texts:
By default, taxonomy terms on a node display with a tag icon:

What's the easiest way to get rid of that icon? Just use hide($content['fieldname']); in my node template and rewrite it the way I want? Or is there a config option somewhere that I've missed that would let me turn it off?


texts: Distinguishing form being built for rendering versus submission

texts:
Is there a way to distinguish, inside a form function, that the form is being built to be rendered on the page, as opposed to being re-built as a result of submission?

I would like to use drupal_set_message() inside the form function, but only while it's being built for rendering.


texts: How to override jQuery from contrib module

texts:
It's from editable fields that I want to override jQuery from. I tried to simply copy the function in question into my scripts.js and make it work but it obviously doesn't.

I'm sure my custom js file loads because I'm already using other code in it. Now, I just put a console.log statement in the beginning of my copied function that is supposed to fire at every .blur(); but nothing's coming out.

I also checked that my custom js code got loaded after the editable fields code (In case I sound stupid: I don't know how far drupal takes care of it to do this by default.)

this is the function - originally from editablefields - that I would like to override

    (function ($) {
Drupal.behaviors.editablefields_submit = {
console.log('override check');
attach: function (context) {
    $('.editablefield-item').once('editablefield', function() {
      var $this = $(this);

      // There is only one editable field in that form, we can hide the submit
      // button.
      if ($this.find('input[type=text],textarea,select').length == 1) {
        $this.find('input.form-submit').hide();
        $this.find('input[type=text],textarea,select').change(function() {
            console.log('this out of override= ' + $this);
          $this.find('input.form-submit').triggerHandler('click');

        });
      }
    });
  }
};


texts: I have a basic module that I made for a survey/email collection form for a site I'm building. I'm very new to drupal and drupal development and I'm trying to figure out how to open this module on the front page after a click on a button inside of a popup of some sort, I was thinking jquery modal or something of the sort. I can't figure out heads or tails from it and don't even know where to put anything. So far I just have the module files survey.info and survey.module. Do I have to modify theme files or what? Sorry for being so green but the development files online aren't very cut and dry.


texts: Why is my Rules data comparison not evaluating correctly?

texts:
This should be easy, but I can't figure out what is going wrong. I have created a field on the user account called "User profile type." It has two options: "General user" and "Grant Network user".

I am trying to create a rule (using the Rules module)to apply a role to these options if they are selected upon saving or updating of the user account form.

However, despite everything I have tried, I can't get the data comparison to evaluate as TRUE:

I am selecting site:current-user:field-user-profile-type:0 as the data to compare.
Then, in the conditions field, I am given the option in the direct input method to choose the item I want.
I am trying to choose "Grant Network user" and it evaluates to FALSE every time no matter what I try.
I have set it up with an OR statement, so that I also am selecting site:current-user:field-user-profile-type:1 as well. But, neither of these will evaluate to TRUE.

The weird thing is that when I test these data selection values in a rule to show a message on the site, they both display a message of "Grant Network user."

So, I don't understand why the data comparison is evaluating to FALSE.

Any ideas? It's probably something simple, but I can't seem to figure it out.

Note: I have tried selecting the field without the colon, but it doesn't seem to work either. It makes sense to try that, but part of my problem is also that I want to be able to select for more than one item. I'd prefer to use a "contains" operator, but it isn't available, so I'm trying to use the "...:0" and "...:1" options with an OR statement to allow for both options being selected. Am I understanding this wrong?


texts:
I have installed ckeditor 3.5.2 with Wysiwyg profiles and every thing works great.
but in admin user  page i can see file browser link . how to add this link like button to ckeditor? i checked buttons like image and imce a but it doesn't add file browser to ckeditor.
at now i have upload files in admin user page and link them with ckeditor.
Anyone have this filebrwoser button (for uploading zip ,...) on ckeditor?


texts: Writing functional tests for a controller that makes call to external service?

texts:
I'm working on the D8 version of the CAS module. To integrate with a single sign on CAS server, this module will have to redirect the user to the CAS server often, and occasionally make cURL requests to that server for validation of various tokens. I'm struggling to write functional tests because of this.

I have a Drupal controller that will redirect the user to a number of places and invoke actions on a number of services, some of which may make cURL requests to the CAS server.

When the controller redirects to the server, I can just tell my web test to NOT follow redirects by overriding the property maxiumRedirects and setting it 0, then inspecting the response to make sure it was a redirect.

But, Since this controller may invoke services that make cURL requests to the CAS server, how would I handle that in a functional test, where that external service does not exist? In a unit test, I can mock the response from Guzzle, but can I do that in a functional test? Is my only option to create a test "server" module (with all the routes defined that CAS client makes requests to) that is enabled only for testing and would be used for testing my CAS client module?


texts:
I am using a custom function. In a button click i want to display view page. Here i want to render my view programatically in html format. How can i do that?

This is my jquery code:

$('.view-all-content').click(function () {

  $.post("/callajax", {
    'action': 'get_data_from_view',

  }, function (data) {

    console.log(data)

    // if (data == "gg") {
    //    console.log("suc")
    // }

    $(".view-all-content-result").html(data);

  });

});

In my function.php

function get_data_from_view() {

  $view = \Drupal::service('renderer')->render(views_embed_view('article_list', 'page_5'));

  // Other code ...

  echo $view;
}


texts: How to hide taxonomy terms with no content

texts: How to display only those taxonomy terms that have content? Can this be done with the help of relationships or contextual filters?


texts: How to configure settings.php to make a second database available to the Feeds module

texts:
I feel like this is a basic set up question, but can't find an answer anywhere.

I am running Drupal 7.3.50 and using the CiviCRM module for managing contacts.  The CiviCRM database is separate, but on the same server.

I want to be able to create Drupal nodes from organisation data in CiviCRM, so need to read the org data into Drupal.  The Feeds module says that it does this very thing even from external databases, citing two possibilities, the Feeds SQL and Feeds Database sub-modules.

I have two questions:

Feeds SQL says it can read data from any database configured in settings.php.  I have configured my civi database as best I can according the instructions in settings.php for using multiple databases, but Feeds SQL can't find the new tables, presumably because it can't find the new database.

My configuration of settings.php looks like:

$databases = array (
  'default' =>
  array (
    'default' =>
    array (
      'database' => 'simeonne_drupal',
      'username' => 'simeonne',
      'password' => '********',
      'host' => 'localhost',
      'port' => '',
      'driver' => 'mysql',
      'prefix' => '',
    ),
  ),
'civicrm' =>
  array (
    'default' =>
    array (
      'database' => 'simeonne_civicrm',
      'username' => 'simeonne',
      'password' => '********',
      'host' => 'localhost',
      'port' => '',
      'driver' => 'mysql',
      'prefix' => '',
    ),
  ),
);

It doesn't cause any errors that I have discovered, but doesn't seem to be recognised by Feeds SQL.

My question is how do I configure settings.php to work with Feeds SQL?

I installed Feeds Database hoping for a bit more user friendly instruction, went through the configuration procedure for a new 'Feeds importer' and nowhere along the way did it ask for any information about the external database, name, server, driver, or SQL query to run.  Nothing.

My question then is how do I configure Feeds Database?

I think these two questions are related which is why I have presumed to ask them in a single post, but I am happy to be disabused of that presumption and create a second post.

Thanks,
Lewis


texts: Migrate custom content type from D6 to D7

texts:
I started with the migrate_D2D module after did try with migrate 2.5. Same issue for me: Import custom content type into a fresh install of D7.

Do I create custom content type first on the D7 intall? Is there no way to import it via d2d?
Do I create custom CCK field into D7 db before mapping field using:
$query->addField('??','field_D6customCCKfield');
or just
$this->addFieldMapping('field_D7name', 'field_D6customCCKfield'); is enought ?
Do I map subfield like field_D6customCCKfield:data?

OK, it's better but my custom fields aren't created and I get this:

  "field_fichier_joint_lycee" was used as destination field in "field_fichier_joint_lycee" mapping but is not in list of destination fields
  "field_lien_page_lycee" was used as destination field in "field_lien_page_lycee" mapping but is not in list of destination fields

In my class do I add this?

$query->addField('??','field_D6customCCKfield')


texts:
I want to remove the link to the homepage from the main menu.

I can delete it with:

menu_link_delete(NULL, "<front>");

But I am worried about needing to undo that at some point in the future, or causing problems when some module expects that link to exist.

It looks like menu_link_save allows marking a menu item as "hidden", but I can't figure out how to get the mlid so that it knows I want to edit an existing menu item.

I have tried calling menu_main_menu, but the result doesn't appear to have a main_menu['<front>'] element.

Any suggestions?


texts: I have a password field which currently displays the current password. How can I force the input to be displayed as blank? From the documentation here, it seems that #default_value or #value don't work (so I can give them an empty string as a value). How can I do this?


texts: How to popup a dialog when a checkbox is unchecked on webform?

texts: I have a checkbox in Webform. By default, the checkbox is selected. I'd like to popup a message dialogbox if the user uncheck the checkbox. How can that be done in Webform?


texts: Main navigiation layout bugs after adding a cart block

texts:
I have a question about some layout problems that I'm having since I installed commerce 2.x on my school project website. I'm using Drupal 8 for this.

You can see that one of the dots between each menu item are gone and another dot is slightly misplaced. Is there a way to restore this or remove all the dots maybe? The domain of my website is designmuseum.vansompel.be

I have been changing some of the css in the most upper sidebar to get the cart block next to the user account menu. Even when I revert these changes, the problem on the main navigation seems to remain.
Could it be that my website is doing some automatic layout tweaks because of the new cart block? For example there is also a 10px padding above the cart block that I didn't specify myself and can't seem to find it in the code also.

.header-top-highlighted__section .block + .block {
  padding: 10px 0 0 0;
}

I'm still pretty nooby at theming so if someone could point me in the right direction, that would be great! Thanks!


texts:
I have an image gallery which I've made using views and each image has a yes/no rate widget. When the image is clicked a popup box is shown with the image in it which I have made using colorbox. I have also added the yes/no rate widget in the pop up box. The problem is that the rate widget is not working in the gallery but it works inside the popup box. How can I make it work in both the places?

This is strange, but when I click on the rate widget in the popup box for a certain image, it starts working in the gallery as well but only for that image.

This is what my views looks like. Only the (Votes)Votes:Value appearing first is working first and then after clicking that the other one works for that particular content.


texts:
I am very new to Drupal. I would like to know how Views module work.
I need clarification on my following understanding about the use of Views module,

"Views are not for creating new content or inputting data, I need to create content with page/article/field collection etc. then I have to provide views module to display those contents using views module."


texts: How to give Permissions to User based on taxonomy selected while creating a content?

texts:
I have a taxonomy called Projects and it has terms like Project1, Project2 etc.
I have added a user called ProjectUser1, and assigned a new role called ProjectRole with it.
Now I want to give Permissions to ProjectRole so that when ProjectUser1 logins, he can only see the content that has Project1 taxonomy and he can Publish, Unpublish, Edit or Delete only those content. He shouldn't be able to see the contents which doesn't have Project1 taxonomy.

Can anyone help?